summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-07-10 04:43:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-07-10 04:43:47 +0000
commit0409e18477359894dba707068d182ec24bf2cf46 (patch)
tree91f0c8bf726938db968193dd046d5f7861dbda6a
parentbf03162c3486044b14d879369dde07477a140a5e (diff)
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.
-rw-r--r--sys/sys/mbuf.h32
1 files 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,