Subject: Re: SoC ideas - mbuf API
To: None <tech-net@NetBSD.org>
From: Pavel Cahyna <pavel@netbsd.org>
List: tech-net
Date: 06/27/2006 23:29:39
On Tue, Jun 27, 2006 at 11:54:21AM -0500, David Young wrote:
> On Wed, Jun 21, 2006 at 09:47:49AM +0200, Pavel Cahyna wrote:
> > For most of the uses the version returning const should be enough. Code
> > which needs a writable pointer to the mbuf could use a mptr_rw macro,
> > which would do a m_makewritable on the returned region. Or such code
> > should be converted to m_copyback, then mptr_rw wouldn't be needed. There
> > shouldn't be many places where writing to mbufs is necessary.
> 
> Careful: m_makewritable does not guarantee that the mbuf is contiguous,
> only that each segment is writable.  That deserves to be explicitly
> mentioned in mbuf(9); I keep forgetting to add that.

Yes, I'm aware of that. A question is if the mptr_rw macro would also
ensure a contiguous region, or if there should be a separate
mptr_rw_pullup macro. (At this point the number of possibilities becomes
large enough that it might be preferable to have just two macros, mptr and
mptr_rw, with an extra "flags" argument, and make the _pullup variants one
of the flags.)

Pavel