Garrett D'Amore wrote:
> I like the idea of the free_func getting passed a third argument, which 
> is the mblk_t * associated.  Then nobody needs to look at db_mblk.  I 
> confess that I'd also feel better if the framework code reset the mblk 
> fields to default, so that drivers were not required to know which 
> fields to change and which not.  (The problem is what happens if sizeof 
> (mblk_t) changes?)
> 
> A way to achieve this without requiring a common switch case might be to 
> add a new function, msgreset() or somesuch, which just clears the 
> initial mblk header fields to reasonable defaults.  Then the free 
> routine could call msgreset() before reusing the mblk.  Thoughts?

I think you're going of at a slight tangent here ;-) There's no need for 
an extra msgreset() call (although I did consider that option myself) 
because the dblk_lastfree_xesb() code can reset the mblk_t fields prior 
to calling free_func(). My code at 
http://cr.opensolaris.org/~pdurrant/stream shows this; check out 
http://cr.opensolaris.org/~pdurrant/stream/usr/src/uts/common/io/stream.c.html 
lines 655-659; they are basically identical to lines 702-706 (in 
gesballoc()).

   Paul

-- 
=========================================================
Paul Durrant                    SolarFlare Communications
Senior Staff Engineer           Block 2, 2nd Floor
TEL: +44 (0)1223 518040         Westbrook Centre
FAX: +44 (0)1223 464225         Milton Road
                                 Cambridge, CB4 1YG
                                 UK
=========================================================

Reply via email to