Constify ifp of if_is_deactivateddiff -r1.366 -r1.367 src/sys/net/if.c
(ozaki-r)
--- 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 | |||
1153 | bool | 1153 | bool | |
1154 | if_is_deactivated(struct ifnet *ifp) | 1154 | if_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 | |||
1160 | void | 1160 | void | |
1161 | if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *)) | 1161 | if_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) { |
--- 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 * | |||
940 | struct ifnet *if_alloc(u_char); | 940 | struct ifnet *if_alloc(u_char); | |
941 | void if_free(struct ifnet *); | 941 | void if_free(struct ifnet *); | |
942 | void if_initname(struct ifnet *, const char *, int); | 942 | void if_initname(struct ifnet *, const char *, int); | |
943 | struct ifaddr *if_dl_create(const struct ifnet *, const struct sockaddr_dl **); | 943 | struct ifaddr *if_dl_create(const struct ifnet *, const struct sockaddr_dl **); | |
944 | void if_activate_sadl(struct ifnet *, struct ifaddr *, | 944 | void if_activate_sadl(struct ifnet *, struct ifaddr *, | |
945 | const struct sockaddr_dl *); | 945 | const struct sockaddr_dl *); | |
946 | void if_set_sadl(struct ifnet *, const void *, u_char, bool); | 946 | void if_set_sadl(struct ifnet *, const void *, u_char, bool); | |
947 | void if_alloc_sadl(struct ifnet *); | 947 | void if_alloc_sadl(struct ifnet *); | |
948 | void if_initialize(struct ifnet *); | 948 | void if_initialize(struct ifnet *); | |
949 | void if_register(struct ifnet *); | 949 | void if_register(struct ifnet *); | |
950 | void if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */ | 950 | void if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */ | |
951 | void if_attachdomain(void); | 951 | void if_attachdomain(void); | |
952 | void if_deactivate(struct ifnet *); | 952 | void if_deactivate(struct ifnet *); | |
953 | bool if_is_deactivated(struct ifnet *); | 953 | bool if_is_deactivated(const struct ifnet *); | |
954 | void if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *)); | 954 | void if_purgeaddrs(struct ifnet *, int, void (*)(struct ifaddr *)); | |
955 | void if_detach(struct ifnet *); | 955 | void if_detach(struct ifnet *); | |
956 | void if_down(struct ifnet *); | 956 | void if_down(struct ifnet *); | |
957 | void if_link_state_change(struct ifnet *, int); | 957 | void if_link_state_change(struct ifnet *, int); | |
958 | void if_up(struct ifnet *); | 958 | void if_up(struct ifnet *); | |
959 | void ifinit(void); | 959 | void ifinit(void); | |
960 | void ifinit1(void); | 960 | void ifinit1(void); | |
961 | int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *); | 961 | int ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *); | |
962 | extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *); | 962 | extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *); | |
963 | int ifioctl_common(struct ifnet *, u_long, void *); | 963 | int ifioctl_common(struct ifnet *, u_long, void *); | |
964 | int ifpromisc(struct ifnet *, int); | 964 | int ifpromisc(struct ifnet *, int); | |
965 | int if_addr_init(ifnet_t *, struct ifaddr *, bool); | 965 | int if_addr_init(ifnet_t *, struct ifaddr *, bool); | |
966 | int if_do_dad(struct ifnet *); | 966 | int if_do_dad(struct ifnet *); |