From owner-cvs-all Sat Sep 21 10:15:34 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 5E3AF37B404; Sat, 21 Sep 2002 10:15:32 -0700 (PDT) Received: from tesla.distributel.net (nat.MTL.distributel.NET [66.38.181.24]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F52143E3B; Sat, 21 Sep 2002 10:15:31 -0700 (PDT) (envelope-from bmilekic@unixdaemons.com) Received: (from bmilekic@localhost) by tesla.distributel.net (8.11.6/8.11.6) id g8LHHYr07881; Sat, 21 Sep 2002 13:17:34 -0400 (EDT) (envelope-from bmilekic@unixdaemons.com) Date: Sat, 21 Sep 2002 13:17:34 -0400 From: Bosko Milekic To: Sam Leffler Cc: Julian Elischer , John Baldwin , Darren Reed , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/kern uipc_mbuf.c Message-ID: <20020921131734.A7856@unixdaemons.com> References: <112201c26191$b8ddefe0$52557f42@errno.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <112201c26191$b8ddefe0$52557f42@errno.com>; from sam@errno.com on Sat, Sep 21, 2002 at 10:10:00AM -0700 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 On Sat, Sep 21, 2002 at 10:10:00AM -0700, Sam Leffler wrote: > There is already an m_apply routine in other systems (I pulled in a copy for > crypto use): > > /* > * Apply function f to the data in an mbuf chain starting "off" bytes from > the > * beginning, continuing for "len" bytes. > */ > extern int m_apply(struct mbuf *m, int off, int len, > int (*f)(caddr_t, caddr_t, unsigned int), caddr_t > fstate); > > (and please no comments about caddr_t use). > > Similarly, a more general alternative to m_length returning a pointer to the > last mbuf is m_getptr that takes an mbuf pointer and an offset (in bytes) > and returns a pointer to the mbuf that holds data at that offset into the > packet and, optionally, a byte offset within that mbuf. > > struct mbuf *m_getptr(struct mbuf *, int, int *); > > Rather than haphazardly sticking in new mbuf routines it would be good if > *bsd could standardize on some set of base set of routines to improve code > portability. At the very least it'd be good to try and add compatible > interfaces when trying to replace redundant code with a core routine. Can you take a look at mbchains in kern/ ? It seems like a nice interface and we already have it. If we're going to standardize on anything it may as well be on something that's been sitting in our tree for over a year now, eh? > Sam -- Bosko Milekic * bmilekic@unixdaemons.com * bmilekic@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message