From owner-freebsd-hackers Mon Oct 16 13:08:50 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA19052 for hackers-outgoing; Mon, 16 Oct 1995 13:08:50 -0700 Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id NAA19047 ; Mon, 16 Oct 1995 13:08:44 -0700 Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA25213; Mon, 16 Oct 1995 13:01:08 -0700 From: Terry Lambert Message-Id: <199510162001.NAA25213@phaeton.artisoft.com> Subject: Re: suggested changes to mbuf routines To: matt@lkg.dec.com (Matt Thomas) Date: Mon, 16 Oct 1995 13:01:07 -0700 (MST) Cc: julian@freefall.freebsd.org, hackers@freefall.freebsd.org In-Reply-To: <199510151123.LAA01923@whydos.lkg.dec.com> from "Matt Thomas" at Oct 15, 95 11:21:25 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1655 Sender: owner-hackers@FreeBSD.org Precedence: bulk > > > In <199510141119.EAA05158@freefall.freebsd.org> , you wrote: > > I find the method of doing the references as done in Digital UNIX > (aka DEC OSF/1) quite clean. Basically the m_ext struct gets an > queue entry added. When the extended mbuf is first allocated, the > link queue entry merely points to itself (an empty queue). As more > references are made, their queues get linked together. As references > are removed, their queues get unlinked. > > To see if there is a non-zero reference count, imply see if the queue > entry points to itself. > > > /* description of external storage mapped into mbuf, valid if M_EXT set */ > struct m_ext { > caddr_t ext_buf; /* start of buffer */ > #if __STDC__ > void (*ext_free)(caddr_t, u_long, caddr_t); > #else > void (*ext_free)(); /* free routine if not the usual */ > #endif ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > u_int ext_size; /* size of buffer, for ext_free */ > caddr_t ext_arg; /* additional ext_free argument */ > struct ext_refq { /* reference list */ > struct ext_refq *forw, *back; > } ext_ref; > }; > > #define MCLREFERENCED(m) \ > ((m)->m_ext.ext_ref.forw != &((m)->m_ext.ext_ref)) This, I like. This: > void (*ext_free)(caddr_t, u_long, caddr_t); Should be: > void (*ext_free) __P((caddr_t, u_long, caddr_t)); Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.