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.
This commit is contained in:
parent
8392d61dfb
commit
c5696d3c25
12
sys/net/if.c
12
sys/net/if.c
@ -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 @@ if_get_byindex(u_int idx, struct psref *psref)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
@ -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 @@ struct ifnet *if_get(const char *, struct psref *);
|
||||
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)
|
||||
|
@ -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 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m,
|
||||
addrsofif++; /* count the address */
|
||||
}
|
||||
if (iffound) {
|
||||
if_acquire_NOMPSAFE(ifp, psref);
|
||||
if_acquire(ifp, psref);
|
||||
pserialize_read_exit(s);
|
||||
*ifpp = ifp;
|
||||
return (addrsofif);
|
||||
|
@ -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 @@ getroute:
|
||||
!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);
|
||||
|
@ -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 @@ ip6_output(
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user