Tue Dec 13 02:05:48 2016 UTC ()
Constify ifp of if_is_deactivated


(ozaki-r)
diff -r1.366 -r1.367 src/sys/net/if.c
diff -r1.231 -r1.232 src/sys/net/if.h

cvs diff -r1.366 -r1.367 src/sys/net/if.c (expand / switch to unified diff)

--- src/sys/net/if.c 2016/12/12 03:55:57 1.366
+++ src/sys/net/if.c 2016/12/13 02:05:48 1.367
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if.c,v 1.366 2016/12/12 03:55:57 ozaki-r Exp $ */ 1/* $NetBSD: if.c,v 1.367 2016/12/13 02:05:48 ozaki-r Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by William Studenmund and Jason R. Thorpe. 8 * by William Studenmund and Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -80,27 +80,27 @@ @@ -80,27 +80,27 @@
80 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 80 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
81 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 81 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
82 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 82 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
83 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 83 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
84 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 84 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
85 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 85 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
86 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 86 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
87 * SUCH DAMAGE. 87 * SUCH DAMAGE.
88 * 88 *
89 * @(#)if.c 8.5 (Berkeley) 1/9/95 89 * @(#)if.c 8.5 (Berkeley) 1/9/95
90 */ 90 */
91 91
92#include <sys/cdefs.h> 92#include <sys/cdefs.h>
93__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.366 2016/12/12 03:55:57 ozaki-r Exp $"); 93__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.367 2016/12/13 02:05:48 ozaki-r Exp $");
94 94
95#if defined(_KERNEL_OPT) 95#if defined(_KERNEL_OPT)
96#include "opt_inet.h" 96#include "opt_inet.h"
97#include "opt_ipsec.h" 97#include "opt_ipsec.h"
98 98
99#include "opt_atalk.h" 99#include "opt_atalk.h"
100#include "opt_natm.h" 100#include "opt_natm.h"
101#include "opt_wlan.h" 101#include "opt_wlan.h"
102#include "opt_net_mpsafe.h" 102#include "opt_net_mpsafe.h"
103#endif 103#endif
104 104
105#include <sys/param.h> 105#include <sys/param.h>
106#include <sys/mbuf.h> 106#include <sys/mbuf.h>
@@ -1141,27 +1141,27 @@ if_deactivate(struct ifnet *ifp) @@ -1141,27 +1141,27 @@ if_deactivate(struct ifnet *ifp)
1141 ifp->if_ioctl = if_nullioctl; 1141 ifp->if_ioctl = if_nullioctl;
1142 ifp->if_init = if_nullinit; 1142 ifp->if_init = if_nullinit;
1143 ifp->if_stop = if_nullstop; 1143 ifp->if_stop = if_nullstop;
1144 ifp->if_slowtimo = if_nullslowtimo; 1144 ifp->if_slowtimo = if_nullslowtimo;
1145 ifp->if_drain = if_nulldrain; 1145 ifp->if_drain = if_nulldrain;
1146 1146
1147 /* No more packets may be enqueued. */ 1147 /* No more packets may be enqueued. */
1148 ifp->if_snd.ifq_maxlen = 0; 1148 ifp->if_snd.ifq_maxlen = 0;
1149 1149
1150 splx(s); 1150 splx(s);
1151} 1151}
1152 1152
1153bool 1153bool
1154if_is_deactivated(struct ifnet *ifp) 1154if_is_deactivated(const struct ifnet *ifp)
1155{ 1155{
1156 1156
1157 return ifp->if_output == if_nulloutput; 1157 return ifp->if_output == if_nulloutput;
1158} 1158}
1159 1159
1160void 1160void
1161if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *)) 1161if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *))
1162{ 1162{
1163 struct ifaddr *ifa, *nifa; 1163 struct ifaddr *ifa, *nifa;
1164 int s; 1164 int s;
1165 1165
1166 s = pserialize_read_enter(); 1166 s = pserialize_read_enter();
1167 for (ifa = IFADDR_READER_FIRST(ifp); ifa; ifa = nifa) { 1167 for (ifa = IFADDR_READER_FIRST(ifp); ifa; ifa = nifa) {

cvs diff -r1.231 -r1.232 src/sys/net/if.h (expand / switch to unified diff)

--- src/sys/net/if.h 2016/12/12 03:55:57 1.231
+++ src/sys/net/if.h 2016/12/13 02:05:48 1.232
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if.h,v 1.231 2016/12/12 03:55:57 ozaki-r Exp $ */ 1/* $NetBSD: if.h,v 1.232 2016/12/13 02:05:48 ozaki-r Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by William Studenmund and Jason R. Thorpe. 8 * by William Studenmund and Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -940,27 +940,27 @@ int ifreq_setaddr(u_long, struct ifreq * @@ -940,27 +940,27 @@ int ifreq_setaddr(u_long, struct ifreq *
940struct ifnet *if_alloc(u_char); 940struct ifnet *if_alloc(u_char);
941void if_free(struct ifnet *); 941void if_free(struct ifnet *);
942void if_initname(struct ifnet *, const char *, int); 942void if_initname(struct ifnet *, const char *, int);
943struct ifaddr *if_dl_create(const struct ifnet *, const struct sockaddr_dl **); 943struct ifaddr *if_dl_create(const struct ifnet *, const struct sockaddr_dl **);
944void if_activate_sadl(struct ifnet *, struct ifaddr *, 944void if_activate_sadl(struct ifnet *, struct ifaddr *,
945 const struct sockaddr_dl *); 945 const struct sockaddr_dl *);
946void if_set_sadl(struct ifnet *, const void *, u_char, bool); 946void if_set_sadl(struct ifnet *, const void *, u_char, bool);
947void if_alloc_sadl(struct ifnet *); 947void if_alloc_sadl(struct ifnet *);
948void if_initialize(struct ifnet *); 948void if_initialize(struct ifnet *);
949void if_register(struct ifnet *); 949void if_register(struct ifnet *);
950void if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */ 950void if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
951void if_attachdomain(void); 951void if_attachdomain(void);
952void if_deactivate(struct ifnet *); 952void if_deactivate(struct ifnet *);
953bool if_is_deactivated(struct ifnet *); 953bool if_is_deactivated(const struct ifnet *);
954void if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *)); 954void if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *));
955void if_detach(struct ifnet *); 955void if_detach(struct ifnet *);
956void if_down(struct ifnet *); 956void if_down(struct ifnet *);
957void if_link_state_change(struct ifnet *, int); 957void if_link_state_change(struct ifnet *, int);
958void if_up(struct ifnet *); 958void if_up(struct ifnet *);
959void ifinit(void); 959void ifinit(void);
960void ifinit1(void); 960void ifinit1(void);
961int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *); 961int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *);
962extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *); 962extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
963int ifioctl_common(struct ifnet *, u_long, void *); 963int ifioctl_common(struct ifnet *, u_long, void *);
964int ifpromisc(struct ifnet *, int); 964int ifpromisc(struct ifnet *, int);
965int if_addr_init(ifnet_t *, struct ifaddr *, bool); 965int if_addr_init(ifnet_t *, struct ifaddr *, bool);
966int if_do_dad(struct ifnet *); 966int if_do_dad(struct ifnet *);