summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2004-10-10 09:16:48 +0000
committerglebius <glebius@FreeBSD.org>2004-10-10 09:16:48 +0000
commit0dda31b4f9124e935eb487053875a46a0736fdcb (patch)
tree21bc13f747714b04a219ff4fc15e72d6a9f9239a
parent1d181e7321e60436a85de690f633ee15f8b2f939 (diff)
downloadFreeBSD-src-0dda31b4f9124e935eb487053875a46a0736fdcb.zip
FreeBSD-src-0dda31b4f9124e935eb487053875a46a0736fdcb.tar.gz
Revert last commit since it breaks API.
Requested by: sam
-rw-r--r--share/man/man9/mbuf_tags.918
-rw-r--r--sys/kern/uipc_mbuf2.c15
-rw-r--r--sys/sys/mbuf.h10
3 files changed, 21 insertions, 22 deletions
diff --git a/share/man/man9/mbuf_tags.9 b/share/man/man9/mbuf_tags.9
index 6992b05..3512945 100644
--- a/share/man/man9/mbuf_tags.9
+++ b/share/man/man9/mbuf_tags.9
@@ -91,7 +91,8 @@ fields are set to type, length,
and
cookie, respectively.
.Va m_tag_free
-points to a function which will be used to free this tag.
+points to
+.Ft _m_tag_free .
Following this structure are
.Va m_tag_len
bytes of space that can be used to store tag-specific information.
@@ -193,16 +194,11 @@ Return the first tag associated with
.It Fn m_tag_free tag
Free
.Fa tag
-using default free method.
-This function should only be used at the end of a custom free method.
-It should never be used to free a packet tag of an unknown origination.
-To perform the latter
-.Fn m_tag_delete
-should be used in case of an attached
-.Fa tag
-or (tag->m_tag_free)(tag)
-should be called in case of a detached
-.Fa tag .
+using its
+.Va m_tag_free
+method.
+.Ft _m_tag_free
+is used by default.
.It Fn m_tag_init mbuf
Initialize the tag storage for packet
.Fa mbuf .
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c
index 52019ad..ceb0881 100644
--- a/sys/kern/uipc_mbuf2.c
+++ b/sys/kern/uipc_mbuf2.c
@@ -301,14 +301,9 @@ m_dup1(struct mbuf *m, int off, int len, int wait)
return n;
}
-/*
- * Free a packet tag.
- * This function should not be called directly, unless you know what you
- * are doing. Use m_tag_delete() or (t->m_tag_free)(t) instead, when you
- * work with a tag that you haven't allocated yourself.
- */
-void
-m_tag_free(struct m_tag *t)
+/* Free a packet tag. */
+static void
+_m_tag_free(struct m_tag *t)
{
#ifdef MAC
if (t->m_tag_id == PACKET_TAG_MACLABEL)
@@ -330,7 +325,7 @@ m_tag_alloc(u_int32_t cookie, int type, int len, int wait)
if (t == NULL)
return NULL;
m_tag_setup(t, cookie, type, len);
- t->m_tag_free = m_tag_free;
+ t->m_tag_free = _m_tag_free;
return t;
}
@@ -341,7 +336,7 @@ m_tag_delete(struct mbuf *m, struct m_tag *t)
KASSERT(m && t, ("m_tag_delete: null argument, m %p t %p", m, t));
m_tag_unlink(m, t);
- (t->m_tag_free)(t);
+ m_tag_free(t);
}
/* Unlink and free a packet tag chain, starting from given tag. */
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 990521f..78053e9 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -648,7 +648,6 @@ struct mbuf *m_uiotombuf(struct uio *, int, int);
struct m_tag *m_tag_alloc(u_int32_t, int, int, int);
void m_tag_delete(struct mbuf *, struct m_tag *);
void m_tag_delete_chain(struct mbuf *, struct m_tag *);
-void m_tag_free(struct m_tag *);
struct m_tag *m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *);
struct m_tag *m_tag_copy(struct m_tag *, int);
int m_tag_copy_chain(struct mbuf *, struct mbuf *, int);
@@ -679,6 +678,15 @@ m_tag_setup(struct m_tag *t, u_int32_t cookie, int type, int len)
}
/*
+ * Reclaim resources associated with a tag.
+ */
+static __inline void
+m_tag_free(struct m_tag *t)
+{
+ (*t->m_tag_free)(t);
+}
+
+/*
* Return the first tag associated with an mbuf.
*/
static __inline struct m_tag *
OpenPOWER on IntegriCloud