Subject: Re: m_pulldown()
To: None <tech-net@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 12/02/1999 10:49:39
>> 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.
One very important aspect of my suggested routine is that there is no
error return, unless you ask for a len greater than the the mbuf chain
can satisfy, and even then, you don't lose the packet (it returns nil,
but the mbuf chain is untouched - note the return value is *not* a
struct mbuf *).
If anyone wants, I can throw together an implementation of what I
suggest in fairly short order.
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B