Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Oct 1995 11:21:25 +0000
From:      Matt Thomas <matt@lkg.dec.com>
To:        Julian Elischer <julian@freefall.freebsd.org>
Cc:        hackers@freefall.freebsd.org
Subject:   Re: suggested changes to mbuf routines 
Message-ID:  <199510151123.LAA01923@whydos.lkg.dec.com>
In-Reply-To: Your message of "Sat, 14 Oct 1995 04:19:35 MST." <199510141119.EAA05158@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

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))


Matt Thomas               Internet:   matt@lkg.dec.com
3am Software Foundry      WWW URL:    <currently homeless>
Westford, MA              Disclaimer: Digital disavows all knowledge
                                      of this message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510151123.LAA01923>