diff options
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, |