diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-20 09:59:20 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2007-07-20 09:59:20 +0000 |
commit | 08e4b840634d753e4bfafb21ee38871401d61680 (patch) | |
tree | d55e4c4159830f3a047e9a48cc7fc2f1b5f41268 /sys | |
parent | f4225c095ae4a89bad3d36386cc6e596fbd26a10 (diff) |
Remove the MFREE() macro and replace it with a call to m_free().
Also remove the _MEXTREMOVE macro which was only used by MFREE.
This time with the uipc_mbuf.c change that I missed last time.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 25 | ||||
-rw-r--r-- | sys/sys/mbuf.h | 32 |
2 files changed, 25 insertions, 32 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index a20212d2ea3..5bec7746a28 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.84 2007/06/02 09:45:32 art Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.85 2007/07/20 09:59:19 claudio Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -239,8 +239,29 @@ struct mbuf * m_free(struct mbuf *m) { struct mbuf *n; + int s; + + s = splvm(); + mbstat.m_mtypes[m->m_type]--; + if (m->m_flags & M_PKTHDR) + m_tag_delete_chain(m); + if (m->m_flags & M_EXT) { + if (MCLISREFERENCED(m)) + _MCLDEREFERENCE(m); + else if (m->m_flags & M_CLUSTER) + pool_put(&mclpool, m->m_ext.ext_buf); + else if (m->m_ext.ext_free) + (*(m->m_ext.ext_free))(m->m_ext.ext_buf, + m->m_ext.ext_size, m->m_ext.ext_arg); + else + free(m->m_ext.ext_buf,m->m_ext.ext_type); + m->m_flags &= ~(M_CLUSTER|M_EXT); + m->m_ext.ext_size = 0; + } + n = m->m_next; + pool_put(&mbpool, m); + splx(s); - MFREE(m, n); return (n); } diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 2aadab47f47..6b0154db73a 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.91 2007/07/10 04:43:46 miod Exp $ */ +/* $OpenBSD: mbuf.h,v 1.92 2007/07/20 09:59:19 claudio Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -299,24 +299,6 @@ struct mbuf { MCLINITREFERENCE(m); \ } while (/* CONSTCOND */ 0) -#define _MEXTREMOVE(m) do { \ - if (MCLISREFERENCED(m)) { \ - _MCLDEREFERENCE(m); \ - } else if ((m)->m_flags & M_CLUSTER) { \ - pool_put(&mclpool, (m)->m_ext.ext_buf); \ - } else if ((m)->m_ext.ext_free) { \ - (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \ - (m)->m_ext.ext_size, (m)->m_ext.ext_arg); \ - } else { \ - free((m)->m_ext.ext_buf,(m)->m_ext.ext_type); \ - } \ - (m)->m_flags &= ~(M_CLUSTER|M_EXT); \ - (m)->m_ext.ext_size = 0; /* why ??? */ \ -} while (/* CONSTCOND */ 0) - -#define MEXTREMOVE(m) \ - MBUFLOCK(_MEXTREMOVE((m));) - /* * Reset the data pointer on an mbuf. */ @@ -337,17 +319,7 @@ do { \ * Free a single mbuf and associated external storage. * Place the successor, if any, in n. */ -#define MFREE(m, n) \ - MBUFLOCK( \ - mbstat.m_mtypes[(m)->m_type]--; \ - if ((m)->m_flags & M_PKTHDR) \ - m_tag_delete_chain((m)); \ - if ((m)->m_flags & M_EXT) { \ - _MEXTREMOVE((m)); \ - } \ - (n) = (m)->m_next; \ - pool_put(&mbpool, (m)); \ - ) +#define MFREE(m, n) n = m_free((m)) /* * Move just m_pkthdr from from to to, |