Subject: Re: m_pulldown()
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: None <itojun@iijlab.net>
List: tech-net
Date: 12/02/1999 17:51:43
>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.
	if mbuf starting at offset "off", with size "len", is contiguous,
	point it.  if not, trim mbuf and point to now-contiguous region.

itojun


/*
 * ensure that [off, off + len) is contiguous on the mbuf chain "m".
 * packet chain before "off" is kept untouched.
 * if offp == NULL, the target will start at <retval, 0> on resulting chain.
 * if offp != NULL, the target will start at <retval, *offp> on resulting chain.
 *
 * on error return (NULL return value), original "m" will be freed.
 *
 * XXX M_TRAILINGSPACE/M_LEADINGSPACE on shared cluster (sharedcluster)
 */
struct mbuf *
m_pulldown(m, off, len, offp)
	struct mbuf *m;
	int off, len;
	int *offp;