Subject: Re: m_pulldown()
To: None <>
From: Matt Thomas <>
List: tech-net
Date: 12/02/1999 15:23:51
At 07:49 AM 12/2/99 , der Mouse wrote:
> >> Suggestion, then: a routine to do that.  Something like this, exact
> >> details of course open to debate:
> >>      void *m_copy_or_point(struct mbuf *m, int len, void *buf);
> >       this is basically what m_pulldown() does.
> > /*
> >  * ensure that [off, off + len) is contiguous on the mbuf chain "m".
> >  * on error return (NULL return value), original "m" will be freed.

The function I'm proposing is:

void *m_extract(struct mbuf *m, size_t offset, size_t len, size_t alignment, void *buf);

which returns a pointer to a region of the mbuf iff the data desired is contiguous and
aligned properly otherwise the supplied parameter buf is returned.  alignment is minimum
alignment required for the buffer.

The routine should panic if offset + len > the length of the mbuf.
Matt Thomas               Internet:
3am Software Foundry      WWW URL:
Cupertino, CA             Disclaimer: I avow all knowledge of this message