Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Copy some KASSERTs from m_move_pkthdr into m_copy_p...



details:   https://anonhg.NetBSD.org/src/rev/bbdab9af48b8
branches:  trunk
changeset: 322557:bbdab9af48b8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon May 07 09:57:37 2018 +0000

description:
Copy some KASSERTs from m_move_pkthdr into m_copy_pkthdr, and reorder the
latter to reduce the diff with the former.

diffstat:

 sys/kern/uipc_mbuf.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r fc0b7e838957 -r bbdab9af48b8 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c      Mon May 07 09:51:02 2018 +0000
+++ b/sys/kern/uipc_mbuf.c      Mon May 07 09:57:37 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_mbuf.c,v 1.214 2018/05/03 07:46:17 maxv Exp $     */
+/*     $NetBSD: uipc_mbuf.c,v 1.215 2018/05/07 09:57:37 maxv Exp $     */
 
 /*
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.214 2018/05/03 07:46:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.215 2018/05/07 09:57:37 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1546,19 +1546,21 @@
 void
 m_copy_pkthdr(struct mbuf *to, struct mbuf *from)
 {
+       KASSERT((to->m_flags & M_EXT) == 0);
+       KASSERT((to->m_flags & M_PKTHDR) == 0 || m_tag_first(to) == NULL);
        KASSERT((from->m_flags & M_PKTHDR) != 0);
 
        to->m_pkthdr = from->m_pkthdr;
        to->m_flags = from->m_flags & M_COPYFLAGS;
+       to->m_data = to->m_pktdat;
+
        SLIST_INIT(&to->m_pkthdr.tags);
        m_tag_copy_chain(to, from);
-       to->m_data = to->m_pktdat;
 }
 
 void
 m_move_pkthdr(struct mbuf *to, struct mbuf *from)
 {
-
        KASSERT((to->m_flags & M_EXT) == 0);
        KASSERT((to->m_flags & M_PKTHDR) == 0 || m_tag_first(to) == NULL);
        KASSERT((from->m_flags & M_PKTHDR) != 0);



Home | Main Index | Thread Index | Old Index