FYI, this case was approved at PSARC this week, with the understanding that you'll pass the mblk to the free function.
-- Garrett Garrett D'Amore wrote: > Paul Durrant wrote: >> 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()). > > > You've made a good point, and I agree, dblk_lastfree_xesb() is the > right place to do that. > > -- Garrett >> >> Paul >> >