aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-16 18:24:51 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-16 18:24:51 -0400
commit95a5afca4a8d2e1cb77e1d4bc6ff9f718dc32f7a (patch)
tree15452d28df4e4d76fc1276e791a7cc3c6e1a9b3a /net
parent00269b54edbf25f3bb0dccb558ae23a6fc77ed86 (diff)
net: Remove CONFIG_KMOD from net/ (towards removing CONFIG_KMOD entirely)
Some code here depends on CONFIG_KMOD to not try to load protocol modules or similar, replace by CONFIG_MODULES where more than just request_module depends on CONFIG_KMOD and and also use try_then_request_module in ebtables. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/af_bluetooth.c8
-rw-r--r--net/bridge/netfilter/ebtables.c15
-rw-r--r--net/can/af_can.c4
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/dccp/ccid.c2
-rw-r--r--net/decnet/dn_dev.c2
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/inet_diag.c2
-rw-r--r--net/ipv4/tcp_cong.c4
-rw-r--r--net/netfilter/nf_conntrack_netlink.c2
-rw-r--r--net/netfilter/nfnetlink.c2
-rw-r--r--net/netlink/af_netlink.c2
-rw-r--r--net/phonet/af_phonet.c3
-rw-r--r--net/sched/act_api.c2
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sched/ematch.c2
-rw-r--r--net/sched/sch_api.c2
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/auth.c2
20 files changed, 20 insertions, 46 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index f6348e078aa4..8f9431a12c6f 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -37,10 +37,7 @@
37#include <linux/poll.h> 37#include <linux/poll.h>
38#include <net/sock.h> 38#include <net/sock.h>
39#include <asm/ioctls.h> 39#include <asm/ioctls.h>
40
41#if defined(CONFIG_KMOD)
42#include <linux/kmod.h> 40#include <linux/kmod.h>
43#endif
44 41
45#include <net/bluetooth/bluetooth.h> 42#include <net/bluetooth/bluetooth.h>
46 43
@@ -145,11 +142,8 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto)
145 if (proto < 0 || proto >= BT_MAX_PROTO) 142 if (proto < 0 || proto >= BT_MAX_PROTO)
146 return -EINVAL; 143 return -EINVAL;
147 144
148#if defined(CONFIG_KMOD) 145 if (!bt_proto[proto])
149 if (!bt_proto[proto]) {
150 request_module("bt-proto-%d", proto); 146 request_module("bt-proto-%d", proto);
151 }
152#endif
153 147
154 err = -EPROTONOSUPPORT; 148 err = -EPROTONOSUPPORT;
155 149
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 5bb88eb0aad4..0fa208e86405 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -305,23 +305,14 @@ find_inlist_lock_noload(struct list_head *head, const char *name, int *error,
305 return NULL; 305 return NULL;
306} 306}
307 307
308#ifndef CONFIG_KMOD
309#define find_inlist_lock(h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m))
310#else
311static void * 308static void *
312find_inlist_lock(struct list_head *head, const char *name, const char *prefix, 309find_inlist_lock(struct list_head *head, const char *name, const char *prefix,
313 int *error, struct mutex *mutex) 310 int *error, struct mutex *mutex)
314{ 311{
315 void *ret; 312 return try_then_request_module(
316 313 find_inlist_lock_noload(head, name, error, mutex),
317 ret = find_inlist_lock_noload(head, name, error, mutex); 314 "%s%s", prefix, name);
318 if (!ret) {
319 request_module("%s%s", prefix, name);
320 ret = find_inlist_lock_noload(head, name, error, mutex);
321 }
322 return ret;
323} 315}
324#endif
325 316
326static inline struct ebt_table * 317static inline struct ebt_table *
327find_table_lock(const char *name, int *error, struct mutex *mutex) 318find_table_lock(const char *name, int *error, struct mutex *mutex)
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 8035fbf526ae..7d4d2b3c137e 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -128,8 +128,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
128 if (net != &init_net) 128 if (net != &init_net)
129 return -EAFNOSUPPORT; 129 return -EAFNOSUPPORT;
130 130
131#ifdef CONFIG_KMOD 131#ifdef CONFIG_MODULES
132 /* try to load protocol module, when CONFIG_KMOD is defined */ 132 /* try to load protocol module kernel is modular */
133 if (!proto_tab[protocol]) { 133 if (!proto_tab[protocol]) {
134 err = request_module("can-proto-%d", protocol); 134 err = request_module("can-proto-%d", protocol);
135 135
diff --git a/net/core/dev.c b/net/core/dev.c
index 1408a083fe4e..868ec0ba8b77 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4956,8 +4956,6 @@ EXPORT_SYMBOL(br_fdb_get_hook);
4956EXPORT_SYMBOL(br_fdb_put_hook); 4956EXPORT_SYMBOL(br_fdb_put_hook);
4957#endif 4957#endif
4958 4958
4959#ifdef CONFIG_KMOD
4960EXPORT_SYMBOL(dev_load); 4959EXPORT_SYMBOL(dev_load);
4961#endif
4962 4960
4963EXPORT_PER_CPU_SYMBOL(softnet_data); 4961EXPORT_PER_CPU_SYMBOL(softnet_data);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3630131fa1fa..31f29d2989fd 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1040,7 +1040,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1040 struct nlattr *linkinfo[IFLA_INFO_MAX+1]; 1040 struct nlattr *linkinfo[IFLA_INFO_MAX+1];
1041 int err; 1041 int err;
1042 1042
1043#ifdef CONFIG_KMOD 1043#ifdef CONFIG_MODULES
1044replay: 1044replay:
1045#endif 1045#endif
1046 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 1046 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
@@ -1129,7 +1129,7 @@ replay:
1129 return -EOPNOTSUPP; 1129 return -EOPNOTSUPP;
1130 1130
1131 if (!ops) { 1131 if (!ops) {
1132#ifdef CONFIG_KMOD 1132#ifdef CONFIG_MODULES
1133 if (kind[0]) { 1133 if (kind[0]) {
1134 __rtnl_unlock(); 1134 __rtnl_unlock();
1135 request_module("rtnl-link-%s", kind); 1135 request_module("rtnl-link-%s", kind);
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c
index 4809753d12ae..8fe931a3d7a1 100644
--- a/net/dccp/ccid.c
+++ b/net/dccp/ccid.c
@@ -154,7 +154,7 @@ struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, gfp_t gfp)
154 struct ccid *ccid = NULL; 154 struct ccid *ccid = NULL;
155 155
156 ccids_read_lock(); 156 ccids_read_lock();
157#ifdef CONFIG_KMOD 157#ifdef CONFIG_MODULES
158 if (ccids[id] == NULL) { 158 if (ccids[id] == NULL) {
159 /* We only try to load if in process context */ 159 /* We only try to load if in process context */
160 ccids_read_unlock(); 160 ccids_read_unlock();
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index ba352588e344..4fd4a4f74e82 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -490,9 +490,7 @@ int dn_dev_ioctl(unsigned int cmd, void __user *arg)
490 return -EFAULT; 490 return -EFAULT;
491 ifr->ifr_name[IFNAMSIZ-1] = 0; 491 ifr->ifr_name[IFNAMSIZ-1] = 0;
492 492
493#ifdef CONFIG_KMOD
494 dev_load(&init_net, ifr->ifr_name); 493 dev_load(&init_net, ifr->ifr_name);
495#endif
496 494
497 switch(cmd) { 495 switch(cmd) {
498 case SIOCGIFADDR: 496 case SIOCGIFADDR:
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index b12dae2b0b2d..abef49376ac8 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -613,9 +613,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
613 if (colon) 613 if (colon)
614 *colon = 0; 614 *colon = 0;
615 615
616#ifdef CONFIG_KMOD
617 dev_load(net, ifr.ifr_name); 616 dev_load(net, ifr.ifr_name);
618#endif
619 617
620 switch (cmd) { 618 switch (cmd) {
621 case SIOCGIFADDR: /* Get interface address */ 619 case SIOCGIFADDR: /* Get interface address */
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 89cb047ab314..564230dabcb8 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -53,11 +53,9 @@ static DEFINE_MUTEX(inet_diag_table_mutex);
53 53
54static const struct inet_diag_handler *inet_diag_lock_handler(int type) 54static const struct inet_diag_handler *inet_diag_lock_handler(int type)
55{ 55{
56#ifdef CONFIG_KMOD
57 if (!inet_diag_table[type]) 56 if (!inet_diag_table[type])
58 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK, 57 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
59 NETLINK_INET_DIAG, type); 58 NETLINK_INET_DIAG, type);
60#endif
61 59
62 mutex_lock(&inet_diag_table_mutex); 60 mutex_lock(&inet_diag_table_mutex);
63 if (!inet_diag_table[type]) 61 if (!inet_diag_table[type])
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 6a250828b767..4ec5b4e97c4e 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -115,7 +115,7 @@ int tcp_set_default_congestion_control(const char *name)
115 115
116 spin_lock(&tcp_cong_list_lock); 116 spin_lock(&tcp_cong_list_lock);
117 ca = tcp_ca_find(name); 117 ca = tcp_ca_find(name);
118#ifdef CONFIG_KMOD 118#ifdef CONFIG_MODULES
119 if (!ca && capable(CAP_SYS_MODULE)) { 119 if (!ca && capable(CAP_SYS_MODULE)) {
120 spin_unlock(&tcp_cong_list_lock); 120 spin_unlock(&tcp_cong_list_lock);
121 121
@@ -244,7 +244,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
244 if (ca == icsk->icsk_ca_ops) 244 if (ca == icsk->icsk_ca_ops)
245 goto out; 245 goto out;
246 246
247#ifdef CONFIG_KMOD 247#ifdef CONFIG_MODULES
248 /* not found attempt to autoload module */ 248 /* not found attempt to autoload module */
249 if (!ca && capable(CAP_SYS_MODULE)) { 249 if (!ca && capable(CAP_SYS_MODULE)) {
250 rcu_read_unlock(); 250 rcu_read_unlock();
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 08e82d64eb6f..2e4ad9671e19 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -822,7 +822,7 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct,
822 822
823 parse_nat_setup = rcu_dereference(nfnetlink_parse_nat_setup_hook); 823 parse_nat_setup = rcu_dereference(nfnetlink_parse_nat_setup_hook);
824 if (!parse_nat_setup) { 824 if (!parse_nat_setup) {
825#ifdef CONFIG_KMOD 825#ifdef CONFIG_MODULES
826 rcu_read_unlock(); 826 rcu_read_unlock();
827 nfnl_unlock(); 827 nfnl_unlock();
828 if (request_module("nf-nat-ipv4") < 0) { 828 if (request_module("nf-nat-ipv4") < 0) {
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 4739f9f961d8..9c0ba17a1ddb 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -137,7 +137,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
137replay: 137replay:
138 ss = nfnetlink_get_subsys(type); 138 ss = nfnetlink_get_subsys(type);
139 if (!ss) { 139 if (!ss) {
140#ifdef CONFIG_KMOD 140#ifdef CONFIG_MODULES
141 nfnl_unlock(); 141 nfnl_unlock();
142 request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type)); 142 request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
143 nfnl_lock(); 143 nfnl_lock();
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 2fd8afac5f71..480184a857d2 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -435,7 +435,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol)
435 return -EPROTONOSUPPORT; 435 return -EPROTONOSUPPORT;
436 436
437 netlink_lock_table(); 437 netlink_lock_table();
438#ifdef CONFIG_KMOD 438#ifdef CONFIG_MODULES
439 if (!nl_table[protocol].registered) { 439 if (!nl_table[protocol].registered) {
440 netlink_unlock_table(); 440 netlink_unlock_table();
441 request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol); 441 request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 9e9c6fce11aa..b9d97effebe3 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -67,11 +67,10 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
67 } 67 }
68 68
69 pnp = phonet_proto_get(protocol); 69 pnp = phonet_proto_get(protocol);
70#ifdef CONFIG_KMOD
71 if (pnp == NULL && 70 if (pnp == NULL &&
72 request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0) 71 request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
73 pnp = phonet_proto_get(protocol); 72 pnp = phonet_proto_get(protocol);
74#endif 73
75 if (pnp == NULL) 74 if (pnp == NULL)
76 return -EPROTONOSUPPORT; 75 return -EPROTONOSUPPORT;
77 if (sock->type != pnp->sock_type) { 76 if (sock->type != pnp->sock_type) {
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 9974b3f04f05..8f457f1e0acf 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -494,7 +494,7 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
494 494
495 a_o = tc_lookup_action_n(act_name); 495 a_o = tc_lookup_action_n(act_name);
496 if (a_o == NULL) { 496 if (a_o == NULL) {
497#ifdef CONFIG_KMOD 497#ifdef CONFIG_MODULES
498 rtnl_unlock(); 498 rtnl_unlock();
499 request_module("act_%s", act_name); 499 request_module("act_%s", act_name);
500 rtnl_lock(); 500 rtnl_lock();
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 8eb79e92e94c..16e7ac9774e5 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -227,7 +227,7 @@ replay:
227 err = -ENOENT; 227 err = -ENOENT;
228 tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]); 228 tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]);
229 if (tp_ops == NULL) { 229 if (tp_ops == NULL) {
230#ifdef CONFIG_KMOD 230#ifdef CONFIG_MODULES
231 struct nlattr *kind = tca[TCA_KIND]; 231 struct nlattr *kind = tca[TCA_KIND];
232 char name[IFNAMSIZ]; 232 char name[IFNAMSIZ];
233 233
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index 5e6f82e0e6f3..e82519e548d7 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -224,7 +224,7 @@ static int tcf_em_validate(struct tcf_proto *tp,
224 224
225 if (em->ops == NULL) { 225 if (em->ops == NULL) {
226 err = -ENOENT; 226 err = -ENOENT;
227#ifdef CONFIG_KMOD 227#ifdef CONFIG_MODULES
228 __rtnl_unlock(); 228 __rtnl_unlock();
229 request_module("ematch-kind-%u", em_hdr->kind); 229 request_module("ematch-kind-%u", em_hdr->kind);
230 rtnl_lock(); 230 rtnl_lock();
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 1122c952aa99..b16ad2972c6b 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -764,7 +764,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
764 struct qdisc_size_table *stab; 764 struct qdisc_size_table *stab;
765 765
766 ops = qdisc_lookup_ops(kind); 766 ops = qdisc_lookup_ops(kind);
767#ifdef CONFIG_KMOD 767#ifdef CONFIG_MODULES
768 if (ops == NULL && kind != NULL) { 768 if (ops == NULL && kind != NULL) {
769 char name[IFNAMSIZ]; 769 char name[IFNAMSIZ];
770 if (nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) { 770 if (nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
diff --git a/net/socket.c b/net/socket.c
index 3e8d4e35c08f..2b7a4b5c9b72 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1142,7 +1142,7 @@ static int __sock_create(struct net *net, int family, int type, int protocol,
1142 1142
1143 sock->type = type; 1143 sock->type = type;
1144 1144
1145#if defined(CONFIG_KMOD) 1145#ifdef CONFIG_MODULES
1146 /* Attempt to load a protocol module if the find failed. 1146 /* Attempt to load a protocol module if the find failed.
1147 * 1147 *
1148 * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user 1148 * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index 6bfea9ed6869..436bf1b4b76c 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -83,10 +83,8 @@ rpcauth_create(rpc_authflavor_t pseudoflavor, struct rpc_clnt *clnt)
83 if (flavor >= RPC_AUTH_MAXFLAVOR) 83 if (flavor >= RPC_AUTH_MAXFLAVOR)
84 goto out; 84 goto out;
85 85
86#ifdef CONFIG_KMOD
87 if ((ops = auth_flavors[flavor]) == NULL) 86 if ((ops = auth_flavors[flavor]) == NULL)
88 request_module("rpc-auth-%u", flavor); 87 request_module("rpc-auth-%u", flavor);
89#endif
90 spin_lock(&rpc_authflavor_lock); 88 spin_lock(&rpc_authflavor_lock);
91 ops = auth_flavors[flavor]; 89 ops = auth_flavors[flavor];
92 if (ops == NULL || !try_module_get(ops->owner)) { 90 if (ops == NULL || !try_module_get(ops->owner)) {