Date: Tue, 12 Nov 1996 09:45:15 -0800 From: Julian Elischer <julian@whistle.com> To: Garrett Wollman <wollman@lcs.mit.edu> Cc: Mark Tinguely <tinguely@plains.nodak.edu>, freebsd-current@freebsd.org Subject: Re: -current mbuf reference function Message-ID: <3288B7AB.167EB0E7@whistle.com> References: <199611121610.KAA13353@plains.nodak.edu> <9611121647.AA09956@halloran-eldar.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Wollman wrote: > > <<On Tue, 12 Nov 1996 10:10:20 -0600 (CST), Mark Tinguely <tinguely@plains.nodak.edu> said: > > > and even worse the MCLFREE macros in sys/mbuf.h only uses: > > > --mclrefcnt[mtocl(p)] == 0 > > > to decrement the reference count and check to see if it time to release. > > This is correct. It is an error to call MCLFREE if there is a free > function (m_ext.ext_free) set. The calling convention could be a lot > better (I'd like to have it take a pointer to the mbuf rather than the > buffer pointer and size parameters).... In the places we use it, the free routine wouldn't know an mbuf if one came up and kicked it in the shins.. I really wanted to copy the syntax of the earlier code, but was afraid that people would yell about bloat.. in that version, the external information was: ext_start address of start of external buffer. ext_size size of external buffer ext_free() function to decrement references/free ext_ref() function to increment references ext_handle opaque ID by which the ext_free and ext_ref functions Identified the object ext_arg2 opaque second argument to ref and free. This avoided overloading the start/size as arguments to the free and allows object to be freed by 'name' or other more abstract schemes, rather than just a pointer.. (or in the scheme we originally used, the extra arg pointed to an associateed structure that was allocated with, but not within the bounds of, the buffer). In that version all external frees used the ext_free() pointer which was usually a pointer to m_clfree() this meant there was an aditional function call when a MACRO might sometimes have been sufficient. (I think it's cleaner though) > > > I think either a increment/decrement flag is needed to m_ext.ext_ref, or an > > additional decrement function is needed > > Nope, that function is m_ext.ext_free. exactly.. it's more a 'remove reference and free if 0' >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3288B7AB.167EB0E7>