Subject: Re: m_defrag() addition
To: Jason Thorpe <thorpej@shagadelic.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 03/02/2005 21:17:00
> So, I think the way it needs to be done is:
> 
> 	error = m_defrag(&m, ...);
> 	if (error != 0) {
> 		/* m_defrag() failed, m still points to old chain. */
> 	} else {
> 		/* m_defrag() succeeded, m now points to new chain, old 
> 		chain freed. */
> 	}

Why not follow the semantics of realloc()?

	new = m_defrag(old, ...);
	if (!new) {
		/* couldn't defrag, old still intact */
		....
		return;
	}
	/* new contains mbuf seq */

Which saves taking the address of the pointer variable.
(and all the effects that has on optimisers)


	David

-- 
David Laight: david@l8s.co.uk