Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Sep 2002 18:51:43 +1000
From:      Darren Reed <darrenr@reed.wattle.id.au>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        John Baldwin <jhb@FreeBSD.org>, Darren Reed <darrenr@reed.wattle.id.au>, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern uipc_mbuf.c
Message-ID:  <200209210851.SAA28535@avalon.reed.wattle.id.au>
In-Reply-To: <17560.1032537069@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
In some email I received from Poul-Henning Kamp, sie wrote:
> In message <XFMail.20020920114059.jhb@FreeBSD.org>, John Baldwin writes:
> >
> >On 20-Sep-2002 Darren Reed wrote:
> 
> >There is nothing intuitive about
> >a function named foo_length() not returning the length of 'foo'.
> 
> man 9 mbuf:
> 
> 	[...]
> 
>            m_length(buf, last)
>            Return the length of the mbuf chain, and optionally a pointer to
>            the last mbuf.

hmm?  m_length() shouldn't be doing the ", and ...".

> Overriding all these (IMO) is the fact that N (> 3) places had
> implemented it in various sundry ways.

Had implemented which ?
Calculating the length or finding the last mbuf ?
Or both ?

> That, for me, is plenty reason to make an official library function
> to do the job.

I don't dispute that there should be a m_length(), however, I do not
agree it should be implemented the way it currently is - also finding
the last mbuf.  There is a clear majority of cases which call m_length()
with last == NULL, all of which are penalised in having to do a loop
through all of the mbuf's rather than extracting m_pkthdr.len when able
to do so.  The patch appended below takes care of this, but I still think
that what you're doing here suggests you need to find some better drugs.

> The fact that Darren not even bothered to read the commit message,
> much less the man page or the code before he jumped in and botched
> it up, is no reason to build a historical landmark bikeshed on the
> spot where it happened.

Well excuse me for not reading _every_ commit message.

I still think you're lazy for not including the comments in uipc_mbuf.c.
I'm freaked that you actually put stuff in mbuf(9) and not there.


Index: uipc_mbuf.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_mbuf.c,v
retrieving revision 1.105
diff -c -r1.105 uipc_mbuf.c
*** uipc_mbuf.c	19 Sep 2002 08:28:41 -0000	1.105
--- uipc_mbuf.c	21 Sep 2002 08:50:04 -0000
***************
*** 727,732 ****
--- 727,735 ----
  	struct mbuf *m;
  	u_int len;
  
+ 	if ((last == NULL) && ((m0->m_pkthdr.flags & M_PKTHDR) != 0))
+ 		return (m0->m_pkthdr.len);
+ 
  	len = 0;
  	for (m = m0; m != NULL; m = m->m_next) {
  		len += m->m_len;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209210851.SAA28535>