summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_mbuf.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-04-08 14:25:47 +0000
committerdes <des@FreeBSD.org>2003-04-08 14:25:47 +0000
commit567ac2b268739a751df819d1aa68404f430151cb (patch)
treea9d6dfe9fba9afa35e60736c6acc2bb7970ecd0a /sys/kern/uipc_mbuf.c
parente105056ea61ca6ae4a0e93115e8916181e93be8b (diff)
downloadFreeBSD-src-567ac2b268739a751df819d1aa68404f430151cb.zip
FreeBSD-src-567ac2b268739a751df819d1aa68404f430151cb.tar.gz
Introduce an M_ASSERTPKTHDR() macro which performs the very common task
of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable. Submitted by: Hiten Pandya <hiten@unixdaemons.com>
Diffstat (limited to 'sys/kern/uipc_mbuf.c')
-rw-r--r--sys/kern/uipc_mbuf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index c6ada18..9caeed9 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -87,8 +87,7 @@ m_move_pkthdr(struct mbuf *to, struct mbuf *from)
#if 0
/* see below for why these are not enabled */
- KASSERT(to->m_flags & M_PKTHDR,
- ("m_move_pkthdr: called on non-header"));
+ M_ASSERTPKTHDR(to);
KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags),
("m_move_pkthdr: to has tags"));
#endif
@@ -125,7 +124,7 @@ m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how)
* smash the pkthdr as needed causing these
* assertions to trip. For now just disable them.
*/
- KASSERT(to->m_flags & M_PKTHDR, ("m_dup_pkthdr: called on non-header"));
+ M_ASSERTPKTHDR(to);
KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags), ("m_dup_pkthdr: to has tags"));
#endif
#ifdef MAC
@@ -349,7 +348,7 @@ m_dup(struct mbuf *m, int how)
/* Sanity check */
if (m == NULL)
return (NULL);
- KASSERT((m->m_flags & M_PKTHDR) != 0, ("%s: !PKTHDR", __func__));
+ M_ASSERTPKTHDR(m);
/* While there's more data, get a new mbuf, tack it on, and fill it */
remain = m->m_pkthdr.len;
OpenPOWER on IntegriCloud