Module Name:    src
Committed By:   maxv
Date:           Fri Apr 27 07:41:58 UTC 2018

Modified Files:
        src/sys/kern: uipc_mbuf.c
        src/sys/sys: mbuf.h

Log Message:
Rename m_reclaim -> mb_drain, and localify.


To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.192 -r1.193 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/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.202 src/sys/kern/uipc_mbuf.c:1.203
--- src/sys/kern/uipc_mbuf.c:1.202	Fri Apr 27 07:20:33 2018
+++ src/sys/kern/uipc_mbuf.c	Fri Apr 27 07:41:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.202 2018/04/27 07:20:33 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.203 2018/04/27 07:41:58 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.202 2018/04/27 07:20:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.203 2018/04/27 07:41:58 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -96,6 +96,7 @@ int max_protohdr;
 int max_hdr;
 int max_datalen;
 
+static void mb_drain(void *, int);
 static int mb_ctor(void *, void *, int);
 
 static void sysctl_kern_mbuf_setup(void);
@@ -191,8 +192,8 @@ mbinit(void)
 	    IPL_VM, NULL, NULL, NULL);
 	KASSERT(mcl_cache != NULL);
 
-	pool_cache_set_drain_hook(mb_cache, m_reclaim, NULL);
-	pool_cache_set_drain_hook(mcl_cache, m_reclaim, NULL);
+	pool_cache_set_drain_hook(mb_cache, mb_drain, NULL);
+	pool_cache_set_drain_hook(mcl_cache, mb_drain, NULL);
 
 	/*
 	 * Set an arbitrary default limit on the number of mbuf clusters.
@@ -237,6 +238,42 @@ mbinit(void)
 #endif
 }
 
+static void
+mb_drain(void *arg, int flags)
+{
+	struct domain *dp;
+	const struct protosw *pr;
+	struct ifnet *ifp;
+	int s;
+
+	KERNEL_LOCK(1, NULL);
+	s = splvm();
+	DOMAIN_FOREACH(dp) {
+		for (pr = dp->dom_protosw;
+		     pr < dp->dom_protoswNPROTOSW; pr++)
+			if (pr->pr_drain)
+				(*pr->pr_drain)();
+	}
+	/* XXX we cannot use psref in H/W interrupt */
+	if (!cpu_intr_p()) {
+		int bound = curlwp_bind();
+		IFNET_READER_FOREACH(ifp) {
+			struct psref psref;
+
+			if_acquire(ifp, &psref);
+
+			if (ifp->if_drain)
+				(*ifp->if_drain)(ifp);
+
+			if_release(ifp, &psref);
+		}
+		curlwp_bindx(bound);
+	}
+	splx(s);
+	mbstat.m_drain++;
+	KERNEL_UNLOCK_ONE(NULL);
+}
+
 /*
  * sysctl helper routine for the kern.mbuf subtree.
  * nmbclusters, mblowat and mcllowat need range
@@ -488,42 +525,6 @@ m_add(struct mbuf *c, struct mbuf *m)
 	return c;
 }
 
-void
-m_reclaim(void *arg, int flags)
-{
-	struct domain *dp;
-	const struct protosw *pr;
-	struct ifnet *ifp;
-	int s;
-
-	KERNEL_LOCK(1, NULL);
-	s = splvm();
-	DOMAIN_FOREACH(dp) {
-		for (pr = dp->dom_protosw;
-		     pr < dp->dom_protoswNPROTOSW; pr++)
-			if (pr->pr_drain)
-				(*pr->pr_drain)();
-	}
-	/* XXX we cannot use psref in H/W interrupt */
-	if (!cpu_intr_p()) {
-		int bound = curlwp_bind();
-		IFNET_READER_FOREACH(ifp) {
-			struct psref psref;
-
-			if_acquire(ifp, &psref);
-
-			if (ifp->if_drain)
-				(*ifp->if_drain)(ifp);
-
-			if_release(ifp, &psref);
-		}
-		curlwp_bindx(bound);
-	}
-	splx(s);
-	mbstat.m_drain++;
-	KERNEL_UNLOCK_ONE(NULL);
-}
-
 struct mbuf *
 m_get(int nowait, int type)
 {

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.192 src/sys/sys/mbuf.h:1.193
--- src/sys/sys/mbuf.h:1.192	Fri Apr 27 07:20:33 2018
+++ src/sys/sys/mbuf.h	Fri Apr 27 07:41:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.192 2018/04/27 07:20:33 maxv Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.193 2018/04/27 07:41:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -852,7 +852,6 @@ void	m_copydata(struct mbuf *, int, int,
 void	m_verify_packet(struct mbuf *);
 struct	mbuf *m_free(struct mbuf *);
 void	m_freem(struct mbuf *);
-void	m_reclaim(void *, int);
 void	mbinit(void);
 void	m_copy_pkthdr(struct mbuf *, struct mbuf *);
 void	m_move_pkthdr(struct mbuf *, struct mbuf *);

Reply via email to