From owner-freebsd-current Tue Nov 12 09:51:15 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id JAA08905 for current-outgoing; Tue, 12 Nov 1996 09:51:15 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id JAA08791 for ; Tue, 12 Nov 1996 09:50:07 -0800 (PST) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.8.2/8.8.2) with SMTP id JAA01022; Tue, 12 Nov 1996 09:45:39 -0800 (PST) Message-ID: <3288B7AB.167EB0E7@whistle.com> Date: Tue, 12 Nov 1996 09:45:15 -0800 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: Garrett Wollman CC: Mark Tinguely , freebsd-current@freebsd.org Subject: Re: -current mbuf reference function References: <199611121610.KAA13353@plains.nodak.edu> <9611121647.AA09956@halloran-eldar.lcs.mit.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Garrett Wollman wrote: > > < 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' >