Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Simplify the mtag API:
details: https://anonhg.NetBSD.org/src/rev/530cb416eae2
branches: trunk
changeset: 445863:530cb416eae2
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Nov 15 10:06:06 2018 +0000
description:
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().
diffstat:
distrib/sets/lists/comp/mi | 26 ++++++++++----------
share/man/man9/Makefile | 6 +----
share/man/man9/m_tag.9 | 57 ++++-----------------------------------------
sys/kern/uipc_mbuf.c | 51 +++++++++-------------------------------
sys/net/if_loop.c | 6 ++--
sys/netcan/can.c | 6 ++--
sys/netinet/ip_icmp.c | 6 ++--
sys/sys/mbuf.h | 8 +----
8 files changed, 42 insertions(+), 124 deletions(-)
diffs (truncated from 416 to 300 lines):
diff -r f4c8b5f79c76 -r 530cb416eae2 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Thu Nov 15 09:38:57 2018 +0000
+++ b/distrib/sets/lists/comp/mi Thu Nov 15 10:06:06 2018 +0000
@@ -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
diff -r f4c8b5f79c76 -r 530cb416eae2 share/man/man9/Makefile
--- a/share/man/man9/Makefile Thu Nov 15 09:38:57 2018 +0000
+++ b/share/man/man9/Makefile Thu Nov 15 10:06:06 2018 +0000
@@ -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 @@
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 \
diff -r f4c8b5f79c76 -r 530cb416eae2 share/man/man9/m_tag.9
--- a/share/man/man9/m_tag.9 Thu Nov 15 09:38:57 2018 +0000
+++ b/share/man/man9/m_tag.9 Thu Nov 15 10:06:06 2018 +0000
@@ -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 @@
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 @@
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
diff -r f4c8b5f79c76 -r 530cb416eae2 sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c Thu Nov 15 09:38:57 2018 +0000
+++ b/sys/kern/uipc_mbuf.c Thu Nov 15 10:06:06 2018 +0000
@@ -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 @@
{
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 @@
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 @@
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 @@
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 @@
}
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(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 @@
{
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 @@
}
return 1;
}
-
-void
-m_tag_init(struct mbuf *m)
-{
- SLIST_INIT(&m->m_pkthdr.tags);
-}
-
-struct m_tag *
Home |
Main Index |
Thread Index |
Old Index