From owner-cvs-all Tue Oct 22 8:37:19 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D8FBB37B401; Tue, 22 Oct 2002 08:37:16 -0700 (PDT) Received: from mta06bw.bigpond.com (mta06bw.bigpond.com [139.134.6.96]) by mx1.FreeBSD.org (Postfix) with ESMTP id AD83A43E42; Tue, 22 Oct 2002 08:37:14 -0700 (PDT) (envelope-from darrenr@reed.wattle.id.au) Received: from CPE-61-9-164-106.vic.bigpond.net.au ([144.135.24.78]) by mta06bw.bigpond.com (Netscape Messaging Server 4.15 mta06bw Jul 16 2002 22:47:55) with SMTP id H4E3E000.BLU; Wed, 23 Oct 2002 01:37:12 +1000 Received: from CPE-203-51-143-179.vic.bigpond.net.au ([203.51.143.179]) by bwmam04.mailsvc.email.bigpond.com(MailRouter V3.0n 35/18664507); 23 Oct 2002 01:37:41 Received: (from root@localhost) by CPE-61-9-164-106.vic.bigpond.net.au (8.11.0/8.11.0) id g8L8r4S05241; Sat, 21 Sep 2002 18:53:04 +1000 From: Darren Reed Message-Id: <200209210851.SAA28535@avalon.reed.wattle.id.au> Subject: Re: cvs commit: src/sys/kern uipc_mbuf.c In-Reply-To: <17560.1032537069@critter.freebsd.dk> To: Poul-Henning Kamp Date: Sat, 21 Sep 2002 18:51:43 +1000 Cc: John Baldwin , Darren Reed , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In some email I received from Poul-Henning Kamp, sie wrote: > In message , 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