From owner-freebsd-hackers Mon Oct 16 20:42:44 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id UAA07468 for hackers-outgoing; Mon, 16 Oct 1995 20:42:44 -0700 Received: from ref.tfs.com (ref.tfs.com [140.145.254.251]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id UAA07458 ; Mon, 16 Oct 1995 20:42:40 -0700 Received: (from julian@localhost) by ref.tfs.com (8.6.11/8.6.9) id UAA17128; Mon, 16 Oct 1995 20:42:27 -0700 Received: from freefall.freebsd.org (freefall [192.216.222.4]) by ref.tfs.com (8.6.11/8.6.9) with ESMTP id SAA16795 for ; Mon, 16 Oct 1995 18:22:50 -0700 Received: from ref.tfs.com (ref.tfs.com [140.145.254.251]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id SAA02520 for ; Mon, 16 Oct 1995 18:23:01 -0700 Received: (from julian@localhost) by ref.tfs.com (8.6.11/8.6.9) id SAA16783; Mon, 16 Oct 1995 18:21:09 -0700 From: Julian Elischer Message-Id: <199510170121.SAA16783@ref.tfs.com> Subject: Re: suggested changes to mbuf routines To: terry@lambert.org (Terry Lambert) Date: Mon, 16 Oct 1995 18:21:08 -0700 (PDT) Cc: matt@lkg.dec.com, julian@freefall.freebsd.org, hackers@freefall.freebsd.orgrgrimes@freebsd.org In-Reply-To: <199510162001.NAA25213@phaeton.artisoft.com> from "Terry Lambert" at Oct 16, 95 01:01:07 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Content-Length: 1498 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. ah I was wondering what that was... I was looking at that in OSF1/i386 and scratching my head about it.. I guess that means that whatever is externally allocated need not have it's own reference counts.. (unless they are also used elsewhere than for mbufs) not sure which I prefer.. rod, is this given in the device driver's book? > > > /* description of external storage mapped into mbuf, valid if M_EXT set */ > struct m_ext { > caddr_t ext_buf; /* start of buffer */ > void (*ext_free)(caddr_t, u_long, caddr_t); > 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))