diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2004-10-09 13:25:19 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2004-10-09 13:25:19 +0000 |
commit | 42c5607501ec855bdf9630b0fff6ed5830b6bd95 (patch) | |
tree | 2147d29faa0ab375bc3aab3bb1f570a107256410 /sys/kern/uipc_mbuf2.c | |
parent | 3b33d41dc2cc38c54e7e35a7c71e264e8dc1434f (diff) |
Remove inlined m_tag_free(). Rename _m_tag_free() to m_tag_free()
and make it visible (same way as in OpenBSD). Describe usage in manpage.
This change is useful for creating custom free methods, which
call default free method at their end.
While here, make malloc declaration for mbuf tags more informative.
Approved by: julian (mentor), sam
MFC after: 1 month
Notes
Notes:
svn path=/head/; revision=136310
Diffstat (limited to 'sys/kern/uipc_mbuf2.c')
-rw-r--r-- | sys/kern/uipc_mbuf2.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c index f5a35ca0aabe..52019adf6ec9 100644 --- a/sys/kern/uipc_mbuf2.c +++ b/sys/kern/uipc_mbuf2.c @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); #include <sys/mbuf.h> #include <sys/mutex.h> -MALLOC_DEFINE(M_PACKET_TAGS, "tag", "packet-attached information"); +MALLOC_DEFINE(M_PACKET_TAGS, "mbuf tags", "packet-attached information"); /* can't call it m_dup(), as freebsd[34] uses m_dup() with different arg */ static struct mbuf *m_dup1(struct mbuf *, int, int, int); @@ -301,9 +301,14 @@ m_dup1(struct mbuf *m, int off, int len, int wait) return n; } -/* Free a packet tag. */ -static void -_m_tag_free(struct m_tag *t) +/* + * 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) { #ifdef MAC if (t->m_tag_id == PACKET_TAG_MACLABEL) @@ -325,7 +330,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; } @@ -336,7 +341,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); - m_tag_free(t); + (t->m_tag_free)(t); } /* Unlink and free a packet tag chain, starting from given tag. */ |