Source-Changes-HG archive

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

[src/trunk]: src/sys Rename if_acquire_NOMPSAFE to if_acquire



details:   https://anonhg.NetBSD.org/src/rev/4acd829dd9d1
branches:  trunk
changeset: 821774:4acd829dd9d1
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Fri Feb 17 03:57:17 2017 +0000

description:
Rename if_acquire_NOMPSAFE to if_acquire

It can be used in MP-safe ways. So let's remove the confusing postfix.
If it's used in a unsafe way, warn NOMPSAFE in a comment.

diffstat:

 sys/net/if.c              |  12 ++++++------
 sys/net/if.h              |   4 ++--
 sys/netinet6/icmp6.c      |   6 +++---
 sys/netinet6/in6_src.c    |   6 +++---
 sys/netinet6/ip6_output.c |   6 +++---
 5 files changed, 17 insertions(+), 17 deletions(-)

diffs (134 lines):

diff -r b655cbdb91ef -r 4acd829dd9d1 sys/net/if.c
--- a/sys/net/if.c      Fri Feb 17 02:56:53 2017 +0000
+++ b/sys/net/if.c      Fri Feb 17 03:57:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $       */
+/*     $NetBSD: if.c,v 1.380 2017/02/17 03:57:17 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.379 2017/02/16 08:13:43 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.380 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2663,12 +2663,12 @@
 }
 
 /*
- * XXX it's safe only if the passed ifp is guaranteed to not be freed,
- * for example the ifp is already held or some other object is held which
- * guarantes the ifp to not be freed indirectly.
+ * Note that it's safe only if the passed ifp is guaranteed to not be freed,
+ * for example using pserialize or the ifp is already held or some other
+ * object is held which guarantes the ifp to not be freed indirectly.
  */
 void
-if_acquire_NOMPSAFE(struct ifnet *ifp, struct psref *psref)
+if_acquire(struct ifnet *ifp, struct psref *psref)
 {
 
        KASSERT(ifp->if_index != 0);
diff -r b655cbdb91ef -r 4acd829dd9d1 sys/net/if.h
--- a/sys/net/if.h      Fri Feb 17 02:56:53 2017 +0000
+++ b/sys/net/if.h      Fri Feb 17 03:57:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.233 2016/12/22 03:46:51 ozaki-r Exp $ */
+/*     $NetBSD: if.h,v 1.234 2017/02/17 03:57:17 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -971,7 +971,7 @@
 ifnet_t *if_byindex(u_int);
 ifnet_t *if_get_byindex(u_int, struct psref *);
 void   if_put(const struct ifnet *, struct psref *);
-void   if_acquire_NOMPSAFE(struct ifnet *, struct psref *);
+void   if_acquire(struct ifnet *, struct psref *);
 
 static inline if_index_t
 if_get_index(const struct ifnet *ifp)
diff -r b655cbdb91ef -r 4acd829dd9d1 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Fri Feb 17 02:56:53 2017 +0000
+++ b/sys/netinet6/icmp6.c      Fri Feb 17 03:57:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.209 2017/02/13 07:18:20 ozaki-r Exp $      */
+/*     $NetBSD: icmp6.c,v 1.210 2017/02/17 03:57:17 ozaki-r Exp $      */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.209 2017/02/13 07:18:20 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.210 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1793,7 +1793,7 @@
                        addrsofif++; /* count the address */
                }
                if (iffound) {
-                       if_acquire_NOMPSAFE(ifp, psref);
+                       if_acquire(ifp, psref);
                        pserialize_read_exit(s);
                        *ifpp = ifp;
                        return (addrsofif);
diff -r b655cbdb91ef -r 4acd829dd9d1 sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c    Fri Feb 17 02:56:53 2017 +0000
+++ b/sys/netinet6/in6_src.c    Fri Feb 17 03:57:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in6_src.c,v 1.78 2017/01/16 15:44:47 christos Exp $    */
+/*     $NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $     */
 /*     $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $     */
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.78 2017/01/16 15:44:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.79 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -773,7 +773,7 @@
            !if_is_deactivated(rt->rt_ifa->ifa_ifp)) {
                if_put(*retifp, psref);
                *retifp = rt->rt_ifa->ifa_ifp;
-               if_acquire_NOMPSAFE(*retifp, psref);
+               if_acquire(*retifp, psref);
        }
 out:
        rtcache_unref(rt, ro);
diff -r b655cbdb91ef -r 4acd829dd9d1 sys/netinet6/ip6_output.c
--- a/sys/netinet6/ip6_output.c Fri Feb 17 02:56:53 2017 +0000
+++ b/sys/netinet6/ip6_output.c Fri Feb 17 03:57:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip6_output.c,v 1.183 2017/02/14 03:05:06 ozaki-r Exp $ */
+/*     $NetBSD: ip6_output.c,v 1.184 2017/02/17 03:57:17 ozaki-r Exp $ */
 /*     $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $    */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.183 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.184 2017/02/17 03:57:17 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -582,7 +582,7 @@
                origifp = ia->ia_ifp;
                if (if_is_deactivated(origifp))
                        goto bad;
-               if_acquire_NOMPSAFE(origifp, &psref_ia);
+               if_acquire(origifp, &psref_ia);
                release_psref_ia = true;
        } else
                origifp = ifp;



Home | Main Index | Thread Index | Old Index