Deleted Added
full compact
34c34
< * $FreeBSD: head/sys/kern/uipc_mbuf.c 105194 2002-10-16 01:54:46Z sam $
---
> * $FreeBSD: head/sys/kern/uipc_mbuf.c 108466 2002-12-30 20:22:40Z sam $
69c69
< * Copy mbuf pkthdr from "from" to "to".
---
> * "Move" mbuf pkthdr from "from" to "to".
71d70
< * aux pointer will be moved to "to".
74c73
< m_copy_pkthdr(struct mbuf *to, struct mbuf *from)
---
> m_move_pkthdr(struct mbuf *to, struct mbuf *from)
77a77
> /* see below for why these are not enabled */
79c79,81
< ("m_copy_pkthdr() called on non-header"));
---
> ("m_move_pkthdr: called on non-header"));
> KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags),
> ("m_move_pkthdr: to has tags"));
80a83
> KASSERT((to->m_flags & M_EXT) == 0, ("m_move_pkthdr: to has cluster"));
84a88
> to->m_flags = from->m_flags & M_COPYFLAGS;
85a90,123
> to->m_pkthdr = from->m_pkthdr; /* especially tags */
> #ifdef MAC
> mac_init_mbuf(to, 1); /* XXXMAC no way to fail */
> mac_create_mbuf_from_mbuf(from, to);
> #endif
> SLIST_INIT(&from->m_pkthdr.tags); /* purge tags from src */
> from->m_flags &= ~M_PKTHDR;
> }
>
> /*
> * Duplicate "from"'s mbuf pkthdr in "to".
> * "from" must have M_PKTHDR set, and "to" must be empty.
> * In particular, this does a deep copy of the packet tags.
> */
> int
> m_dup_pkthdr(struct mbuf *to, struct mbuf *from, int how)
> {
>
> #if 0
> /*
> * The mbuf allocator only initializes the pkthdr
> * when the mbuf is allocated with MGETHDR. Many users
> * (e.g. m_copy*, m_prepend) use MGET and then
> * 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"));
> KASSERT(SLIST_EMPTY(&to->m_pkthdr.tags), ("m_dup_pkthdr: to has tags"));
> #endif
> KASSERT((to->m_flags & M_EXT) == 0, ("m_dup_pkthdr: to has cluster"));
> #ifdef MAC
> if (to->m_flags & M_PKTHDR)
> mac_destroy_mbuf(to);
> #endif
86a125
> to->m_data = to->m_pktdat;
92c131,132
< SLIST_INIT(&from->m_pkthdr.tags);
---
> SLIST_INIT(&to->m_pkthdr.tags);
> return (m_tag_copy_chain(to, from, how));
111c151
< M_COPY_PKTHDR(mn, m);
---
> M_MOVE_PKTHDR(mn, m);
115d154
< m->m_flags &= ~M_PKTHDR;
164c203,204
< M_COPY_PKTHDR(n, m);
---
> if (!m_dup_pkthdr(n, m, wait))
> goto nospace;
215c255,256
< M_COPY_PKTHDR(n, m);
---
> if (!m_dup_pkthdr(n, m, how))
> goto nospace;
312c353,354
< M_COPY_PKTHDR(n, m);
---
> if (!m_dup_pkthdr(n, m, how))
> goto nospace;
487,490c529,530
< if (n->m_flags & M_PKTHDR) {
< M_COPY_PKTHDR(m, n);
< n->m_flags &= ~M_PKTHDR;
< }
---
> if (n->m_flags & M_PKTHDR)
> M_MOVE_PKTHDR(m, n);