Module Name: src Committed By: maxv Date: Thu Nov 15 10:06:07 UTC 2018
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile m_tag.9 src/sys/kern: uipc_mbuf.c src/sys/net: if_loop.c src/sys/netcan: can.c src/sys/netinet: ip_icmp.c src/sys/sys: mbuf.h Log Message: Simplify the mtag API: - Remove m_tag_init(), m_tag_first(), m_tag_next() and m_tag_delete_nonpersistent(). - Remove the 't' argument from m_tag_delete_chain(). To generate a diff of this commit: cvs rdiff -u -r1.2237 -r1.2238 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.431 -r1.432 src/share/man/man9/Makefile cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/m_tag.9 cvs rdiff -u -r1.221 -r1.222 src/sys/kern/uipc_mbuf.c cvs rdiff -u -r1.105 -r1.106 src/sys/net/if_loop.c cvs rdiff -u -r1.4 -r1.5 src/sys/netcan/can.c cvs rdiff -u -r1.174 -r1.175 src/sys/netinet/ip_icmp.c cvs rdiff -u -r1.211 -r1.212 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2237 src/distrib/sets/lists/comp/mi:1.2238 --- src/distrib/sets/lists/comp/mi:1.2237 Sun Oct 28 00:44:37 2018 +++ src/distrib/sets/lists/comp/mi Thu Nov 15 10:06:06 2018 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.2237 2018/10/28 00:44:37 uwe Exp $ +# $NetBSD: mi,v 1.2238 2018/11/15 10:06:06 maxv Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. ./etc/mtree/set.comp comp-sys-root @@ -11235,13 +11235,13 @@ ./usr/share/man/cat9/m_tag_copy_chain.0 comp-sys-catman .cat ./usr/share/man/cat9/m_tag_delete.0 comp-sys-catman .cat ./usr/share/man/cat9/m_tag_delete_chain.0 comp-sys-catman .cat -./usr/share/man/cat9/m_tag_delete_nonpersistent.0 comp-sys-catman .cat +./usr/share/man/cat9/m_tag_delete_nonpersistent.0 comp-obsolete obsolete ./usr/share/man/cat9/m_tag_find.0 comp-sys-catman .cat -./usr/share/man/cat9/m_tag_first.0 comp-sys-catman .cat +./usr/share/man/cat9/m_tag_first.0 comp-obsolete obsolete ./usr/share/man/cat9/m_tag_free.0 comp-sys-catman .cat ./usr/share/man/cat9/m_tag_get.0 comp-sys-catman .cat -./usr/share/man/cat9/m_tag_init.0 comp-sys-catman .cat -./usr/share/man/cat9/m_tag_next.0 comp-sys-catman .cat +./usr/share/man/cat9/m_tag_init.0 comp-obsolete obsolete +./usr/share/man/cat9/m_tag_next.0 comp-obsolete obsolete ./usr/share/man/cat9/m_tag_prepend.0 comp-sys-catman .cat ./usr/share/man/cat9/m_tag_unlink.0 comp-sys-catman .cat ./usr/share/man/cat9/makeiplcookie.0 comp-sys-catman .cat @@ -19048,13 +19048,13 @@ ./usr/share/man/html9/m_tag_copy_chain.html comp-sys-htmlman html ./usr/share/man/html9/m_tag_delete.html comp-sys-htmlman html ./usr/share/man/html9/m_tag_delete_chain.html comp-sys-htmlman html -./usr/share/man/html9/m_tag_delete_nonpersistent.html comp-sys-htmlman html +./usr/share/man/html9/m_tag_delete_nonpersistent.html comp-obsolete obsolete ./usr/share/man/html9/m_tag_find.html comp-sys-htmlman html -./usr/share/man/html9/m_tag_first.html comp-sys-htmlman html +./usr/share/man/html9/m_tag_first.html comp-obsolete obsolete ./usr/share/man/html9/m_tag_free.html comp-sys-htmlman html ./usr/share/man/html9/m_tag_get.html comp-sys-htmlman html -./usr/share/man/html9/m_tag_init.html comp-sys-htmlman html -./usr/share/man/html9/m_tag_next.html comp-sys-htmlman html +./usr/share/man/html9/m_tag_init.html comp-obsolete obsolete +./usr/share/man/html9/m_tag_next.html comp-obsolete obsolete ./usr/share/man/html9/m_tag_prepend.html comp-sys-htmlman html ./usr/share/man/html9/m_tag_unlink.html comp-sys-htmlman html ./usr/share/man/html9/makeiplcookie.html comp-sys-htmlman html @@ -27015,13 +27015,13 @@ ./usr/share/man/man9/m_tag_copy_chain.9 comp-sys-man .man ./usr/share/man/man9/m_tag_delete.9 comp-sys-man .man ./usr/share/man/man9/m_tag_delete_chain.9 comp-sys-man .man -./usr/share/man/man9/m_tag_delete_nonpersistent.9 comp-sys-man .man +./usr/share/man/man9/m_tag_delete_nonpersistent.9 comp-obsolete obsolete ./usr/share/man/man9/m_tag_find.9 comp-sys-man .man -./usr/share/man/man9/m_tag_first.9 comp-sys-man .man +./usr/share/man/man9/m_tag_first.9 comp-obsolete obsolete ./usr/share/man/man9/m_tag_free.9 comp-sys-man .man ./usr/share/man/man9/m_tag_get.9 comp-sys-man .man -./usr/share/man/man9/m_tag_init.9 comp-sys-man .man -./usr/share/man/man9/m_tag_next.9 comp-sys-man .man +./usr/share/man/man9/m_tag_init.9 comp-obsolete obsolete +./usr/share/man/man9/m_tag_next.9 comp-obsolete obsolete ./usr/share/man/man9/m_tag_prepend.9 comp-sys-man .man ./usr/share/man/man9/m_tag_unlink.9 comp-sys-man .man ./usr/share/man/man9/makeiplcookie.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.431 src/share/man/man9/Makefile:1.432 --- src/share/man/man9/Makefile:1.431 Fri Oct 5 09:51:55 2018 +++ src/share/man/man9/Makefile Thu Nov 15 10:06:06 2018 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.431 2018/10/05 09:51:55 hannken Exp $ +# $NetBSD: Makefile,v 1.432 2018/11/15 10:06:06 maxv Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -546,13 +546,9 @@ MLINKS+=m_tag.9 m_tag_copy.9 \ m_tag.9 m_tag_copy_chain.9 \ m_tag.9 m_tag_delete.9 \ m_tag.9 m_tag_delete_chain.9 \ - m_tag.9 m_tag_delete_nonpersistent.9 \ m_tag.9 m_tag_find.9 \ - m_tag.9 m_tag_first.9 \ m_tag.9 m_tag_free.9 \ m_tag.9 m_tag_get.9 \ - m_tag.9 m_tag_init.9 \ - m_tag.9 m_tag_next.9 \ m_tag.9 m_tag_prepend.9 \ m_tag.9 m_tag_unlink.9 MLINKS+=namecache.9 cache_lookup.9 \ Index: src/share/man/man9/m_tag.9 diff -u src/share/man/man9/m_tag.9:1.6 src/share/man/man9/m_tag.9:1.7 --- src/share/man/man9/m_tag.9:1.6 Thu Nov 15 09:38:57 2018 +++ src/share/man/man9/m_tag.9 Thu Nov 15 10:06:06 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: m_tag.9,v 1.6 2018/11/15 09:38:57 maxv Exp $ +.\" $NetBSD: m_tag.9,v 1.7 2018/11/15 10:06:06 maxv Exp $ .\" .\" Copyright (c)2004 YAMAMOTO Takashi, .\" All rights reserved. @@ -36,13 +36,9 @@ .Nm m_tag_unlink , .Nm m_tag_delete , .Nm m_tag_delete_chain , -.Nm m_tag_delete_nonpersistent , .Nm m_tag_find , .Nm m_tag_copy , -.Nm m_tag_copy_chain , -.Nm m_tag_init , -.Nm m_tag_first , -.Nm m_tag_next +.Nm m_tag_copy_chain .Nd mbuf tagging interfaces .\" ------------------------------------------------------------ .Sh SYNOPSIS @@ -58,21 +54,13 @@ .Ft void .Fn m_tag_delete "struct mbuf *m" "struct m_tag *t" .Ft void -.Fn m_tag_delete_chain "struct mbuf *m" "struct m_tag *t" -.Ft void -.Fn m_tag_delete_nonpersistent "struct mbuf *" +.Fn m_tag_delete_chain "struct mbuf *m" .Ft struct m_tag * .Fn m_tag_find "struct mbuf *m" "int type" "struct m_tag *t" .Ft struct m_tag * .Fn m_tag_copy "struct m_tag *m" .Ft int .Fn m_tag_copy_chain "struct mbuf *to" "struct mbuf *from" -.Ft void -.Fn m_tag_init "struct mbuf *m" -.Ft struct m_tag * -.Fn m_tag_first "struct mbuf *m" -.Ft struct m_tag * -.Fn m_tag_next "struct mbuf *m" "struct m_tag *t" .\" ------------------------------------------------------------ .Sh DESCRIPTION The @@ -129,21 +117,8 @@ The same as followed by .Fn m_tag_free . .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.It Fn m_tag_delete_chain "m" "t" -Unlink and free mbuf tags beginning with the mbuf tag -.Fa t -from the mbuf -.Fa m . -If -.Fa t -is -.Dv NULL , -.Fn m_tag_delete_chain -unlinks and frees all mbuf tags associated with the mbuf -.Fa m . -.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.It Fn m_tag_delete_nonpersistent "m" -Unlink and free all non persistent tags associated with the mbuf +.It Fn m_tag_delete_chain "m" +Unlink and free mbuf tags from the mbuf .Fa m . .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .It Fn m_tag_find "m" "type" "t" @@ -180,28 +155,6 @@ already has any mbuf tags, they will be Return 1 on success. Otherwise return 0. .\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.It Fn m_tag_init "m" -Initialize mbuf tag chain of the mbuf -.Fa m . -.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.It Fn m_tag_first "m" -Return the first mbuf tag associated with the mbuf -.Fa m . -Return -.Dv NULL -if no mbuf tags are found. -.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.It Fn m_tag_next "m" "t" -Return the next mbuf tag after -.Fa t -associated with the mbuf -.Fa m . -Return -.Dv NULL -if -.Fa t -is the last tag in the chain. -.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .El .\" ------------------------------------------------------------ .Sh CODE REFERENCES Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.221 src/sys/kern/uipc_mbuf.c:1.222 --- src/sys/kern/uipc_mbuf.c:1.221 Thu Nov 15 09:38:57 2018 +++ src/sys/kern/uipc_mbuf.c Thu Nov 15 10:06:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.221 2018/11/15 09:38:57 maxv Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.222 2018/11/15 10:06:07 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.221 2018/11/15 09:38:57 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.222 2018/11/15 10:06:07 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_mbuftrace.h" @@ -1721,7 +1721,7 @@ m_remove_pkthdr(struct mbuf *m) { KASSERT(m->m_flags & M_PKTHDR); - m_tag_delete_chain(m, NULL); + m_tag_delete_chain(m); m->m_flags &= ~M_PKTHDR; memset(&m->m_pkthdr, 0, sizeof(m->m_pkthdr)); } @@ -1730,7 +1730,8 @@ 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((to->m_flags & M_PKTHDR) == 0 || + SLIST_FIRST(&to->m_pkthdr.tags) == NULL); KASSERT((from->m_flags & M_PKTHDR) != 0); to->m_pkthdr = from->m_pkthdr; @@ -1745,7 +1746,8 @@ 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((to->m_flags & M_PKTHDR) == 0 || + SLIST_FIRST(&to->m_pkthdr.tags) == NULL); KASSERT((from->m_flags & M_PKTHDR) != 0); to->m_pkthdr = from->m_pkthdr; @@ -1905,7 +1907,7 @@ m_free(struct mbuf *m) mbstat_type_add(m->m_type, -1); if (m->m_flags & M_PKTHDR) - m_tag_delete_chain(m, NULL); + m_tag_delete_chain(m); n = m->m_next; @@ -2257,14 +2259,11 @@ m_tag_delete(struct mbuf *m, struct m_ta } void -m_tag_delete_chain(struct mbuf *m, struct m_tag *t) +m_tag_delete_chain(struct mbuf *m) { struct m_tag *p, *q; - if (t != NULL) - p = t; - else - p = SLIST_FIRST(&m->m_pkthdr.tags); + p = SLIST_FIRST(&m->m_pkthdr.tags); if (p == NULL) return; while ((q = SLIST_NEXT(p, m_tag_link)) != NULL) @@ -2272,14 +2271,6 @@ m_tag_delete_chain(struct mbuf *m, struc m_tag_delete(m, p); } -void -m_tag_delete_nonpersistent(struct mbuf *m) -{ - /* NetBSD has no persistent tags yet, so just delete all tags. */ - m_tag_delete_chain(m, NULL); -} - - struct m_tag * m_tag_find(const struct mbuf *m, int type, struct m_tag *t) { @@ -2320,11 +2311,11 @@ m_tag_copy_chain(struct mbuf *to, struct { struct m_tag *p, *t, *tprev = NULL; - m_tag_delete_chain(to, NULL); + m_tag_delete_chain(to); SLIST_FOREACH(p, &from->m_pkthdr.tags, m_tag_link) { t = m_tag_copy(p); if (t == NULL) { - m_tag_delete_chain(to, NULL); + m_tag_delete_chain(to); return 0; } if (tprev == NULL) @@ -2335,21 +2326,3 @@ m_tag_copy_chain(struct mbuf *to, struct } return 1; } - -void -m_tag_init(struct mbuf *m) -{ - SLIST_INIT(&m->m_pkthdr.tags); -} - -struct m_tag * -m_tag_first(struct mbuf *m) -{ - return (SLIST_FIRST(&m->m_pkthdr.tags)); -} - -struct m_tag * -m_tag_next(struct mbuf *m, struct m_tag *t) -{ - return (SLIST_NEXT(t, m_tag_link)); -} Index: src/sys/net/if_loop.c diff -u src/sys/net/if_loop.c:1.105 src/sys/net/if_loop.c:1.106 --- src/sys/net/if_loop.c:1.105 Fri Aug 10 06:46:09 2018 +++ src/sys/net/if_loop.c Thu Nov 15 10:06:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_loop.c,v 1.105 2018/08/10 06:46:09 maxv Exp $ */ +/* $NetBSD: if_loop.c,v 1.106 2018/11/15 10:06:07 maxv Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.105 2018/08/10 06:46:09 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.106 2018/11/15 10:06:07 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -298,7 +298,7 @@ looutput(struct ifnet *ifp, struct mbuf } #endif /* ALTQ */ - m_tag_delete_nonpersistent(m); + m_tag_delete_chain(m); #ifdef MPLS if (rt != NULL && rt_gettag(rt) != NULL && Index: src/sys/netcan/can.c diff -u src/sys/netcan/can.c:1.4 src/sys/netcan/can.c:1.5 --- src/sys/netcan/can.c:1.4 Tue Jun 26 06:48:03 2018 +++ src/sys/netcan/can.c Thu Nov 15 10:06:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: can.c,v 1.4 2018/06/26 06:48:03 msaitoh Exp $ */ +/* $NetBSD: can.c,v 1.5 2018/11/15 10:06:07 maxv Exp $ */ /*- * Copyright (c) 2003, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.4 2018/06/26 06:48:03 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: can.c,v 1.5 2018/11/15 10:06:07 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -271,7 +271,7 @@ can_mbuf_tag_clean(struct mbuf *m) if (sotag) m_tag_unlink(m, sotag); - m_tag_delete_nonpersistent(m); + m_tag_delete_chain(m); if (sotag) m_tag_prepend(m, sotag); } Index: src/sys/netinet/ip_icmp.c diff -u src/sys/netinet/ip_icmp.c:1.174 src/sys/netinet/ip_icmp.c:1.175 --- src/sys/netinet/ip_icmp.c:1.174 Fri Sep 14 05:09:51 2018 +++ src/sys/netinet/ip_icmp.c Thu Nov 15 10:06:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_icmp.c,v 1.174 2018/09/14 05:09:51 maxv Exp $ */ +/* $NetBSD: ip_icmp.c,v 1.175 2018/11/15 10:06:07 maxv Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -94,7 +94,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.174 2018/09/14 05:09:51 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.175 2018/11/15 10:06:07 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_ipsec.h" @@ -919,7 +919,7 @@ icmp_reflect(struct mbuf *m) memmove(ip + 1, (char *)ip + optlen, (unsigned)(m->m_len - sizeof(struct ip))); } - m_tag_delete_nonpersistent(m); + m_tag_delete_chain(m); m->m_flags &= ~(M_BCAST|M_MCAST); /* Index: src/sys/sys/mbuf.h diff -u src/sys/sys/mbuf.h:1.211 src/sys/sys/mbuf.h:1.212 --- src/sys/sys/mbuf.h:1.211 Fri Oct 12 05:49:38 2018 +++ src/sys/sys/mbuf.h Thu Nov 15 10:06:07 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mbuf.h,v 1.211 2018/10/12 05:49:38 msaitoh Exp $ */ +/* $NetBSD: mbuf.h,v 1.212 2018/11/15 10:06:07 maxv Exp $ */ /* * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc. @@ -818,14 +818,10 @@ void m_tag_free(struct m_tag *); void m_tag_prepend(struct mbuf *, struct m_tag *); void m_tag_unlink(struct mbuf *, struct m_tag *); void m_tag_delete(struct mbuf *, struct m_tag *); -void m_tag_delete_chain(struct mbuf *, struct m_tag *); -void m_tag_delete_nonpersistent(struct mbuf *); +void m_tag_delete_chain(struct mbuf *); struct m_tag *m_tag_find(const struct mbuf *, int, struct m_tag *); struct m_tag *m_tag_copy(struct m_tag *); int m_tag_copy_chain(struct mbuf *, struct mbuf *); -void m_tag_init(struct mbuf *); -struct m_tag *m_tag_first(struct mbuf *); -struct m_tag *m_tag_next(struct mbuf *, struct m_tag *); /* Packet tag types */ #define PACKET_TAG_NONE 0 /* Nothing */