From 0409e18477359894dba707068d182ec24bf2cf46 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Tue, 10 Jul 2007 04:43:47 +0000 Subject: Revert previous commit, it probably was intended to come with matching changes to uipc_mbuf.c, but right now all it causes is infinite recursion. --- sys/sys/mbuf.h | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index c00ee06cc11..2aadab47f47 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.90 2007/07/09 19:41:53 claudio Exp $ */ +/* $OpenBSD: mbuf.h,v 1.91 2007/07/10 04:43:46 miod Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -299,6 +299,24 @@ 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. */ @@ -319,7 +337,17 @@ do { \ * Free a single mbuf and associated external storage. * Place the successor, if any, in n. */ -#define MFREE(m, n) n = m_free((m)) +#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)); \ + ) /* * Move just m_pkthdr from from to to, -- cgit v1.2.3