From owner-freebsd-arch Fri Mar 7 1:22:59 2003 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B745D37B401 for ; Fri, 7 Mar 2003 01:22:58 -0800 (PST) Received: from angelica.unixdaemons.com (angelica.unixdaemons.com [209.148.64.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id C357843FA3 for ; Fri, 7 Mar 2003 01:22:57 -0800 (PST) (envelope-from hiten@angelica.unixdaemons.com) Received: from angelica.unixdaemons.com (localhost.unixdaemons.com [127.0.0.1]) by angelica.unixdaemons.com (8.12.8/8.12.1) with ESMTP id h279Mumq070274; Fri, 7 Mar 2003 04:22:56 -0500 (EST) Received: (from hiten@localhost) by angelica.unixdaemons.com (8.12.8/8.12.1/Submit) id h279MuQd070273; Fri, 7 Mar 2003 04:22:56 -0500 (EST) (envelope-from hiten) Date: Fri, 7 Mar 2003 04:22:56 -0500 From: Hiten Pandya To: Luigi Rizzo Cc: arch@FreeBSD.ORG Subject: Re: Using m_getcl() in network and nfs code paths Message-ID: <20030307092256.GA69971@unixdaemons.com> References: <20030307004958.GA98917@unixdaemons.com> <20030306212638.A32850@xorpc.icir.org> <20030307080659.GA60937@unixdaemons.com> <20030307002525.A50491@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030307002525.A50491@xorpc.icir.org> User-Agent: Mutt/1.4i X-Operating-System: FreeBSD i386 X-Public-Key: http://www.pittgoth.com/~hiten/pubkey.asc X-URL: http://www.unixdaemons.com/~hiten X-PGP: http://pgp.mit.edu:11371/pks/lookup?search=Hiten+Pandya&op=index Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Luigi Rizzo (Fri, Mar 07, 2003 at 12:25:25AM -0800) wrote: > the logic of this code > > m = (n > X) ? m_getcl(...) : m_get(...) > > The following: i have n bytes of data, give me a place large > enough to store them. This can be either a single mbuf or an > mbuf+cluster, depending on the size. The threshold (X) is whatever > fits into the mbuf (which varies depending on whether or not this is > a pkthdr mbuf, but again this is easy to tell inside m_getcl because > you are passing the M_PKTHDR flag). > > Now, MINCLSIZE/MHLEN are basically the same thing, and MLEN covers > the case for !M_PKTHDR. But my point is that the programmer should > not bother to know which one to use and instead just let the function > do the right thing. Fewer chances for bugs, and smaller code. Right. I guess it makes better sense. I will try and come up with these changes over the weekend, or maybe even today if I get the time. Cheers Luigi. -- Hiten To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message