Date: Sat, 21 Sep 2002 13:17:34 -0400 From: Bosko Milekic <bmilekic@unixdaemons.com> To: Sam Leffler <sam@errno.com> Cc: Julian Elischer <julian@elischer.org>, 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: <20020921131734.A7856@unixdaemons.com> In-Reply-To: <112201c26191$b8ddefe0$52557f42@errno.com>; from sam@errno.com on Sat, Sep 21, 2002 at 10:10:00AM -0700 References: <Pine.BSF.4.21.0209201236320.16925-100000@InterJet.elischer.org> <112201c26191$b8ddefe0$52557f42@errno.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020921131734.A7856>
