From: Johannes Berg <johannes@sipsolutions.net>
To: linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
Christoph Hellwig <hch@infradead.org>,
netdev@vger.kernel.org
Subject: [RFC 08/11] remove CONFIG_KMOD from net
Date: Tue, 08 Jul 2008 19:00:23 +0200 [thread overview]
Message-ID: <20080708170047.433712000@sipsolutions.net> (raw)
In-Reply-To: 20080708170015.470877000@sipsolutions.net
[-- Attachment #1: config-kmod-remove-net.patch --]
[-- Type: text/plain, Size: 10532 bytes --]
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>
Cc: netdev@vger.kernel.org
---
include/linux/netdevice.h | 5 ++++-
net/bluetooth/af_bluetooth.c | 8 +-------
net/bridge/netfilter/ebtables.c | 15 +++------------
net/can/af_can.c | 4 ++--
net/core/dev.c | 2 +-
net/core/rtnetlink.c | 4 ++--
net/dccp/ccid.c | 2 +-
net/decnet/dn_dev.c | 2 --
net/ipv4/devinet.c | 2 --
net/ipv4/inet_diag.c | 2 --
net/ipv4/tcp_cong.c | 4 ++--
net/netfilter/nfnetlink.c | 2 +-
net/netlink/af_netlink.c | 2 +-
net/sched/act_api.c | 2 +-
net/sched/cls_api.c | 2 +-
net/sched/ematch.c | 2 +-
net/sched/sch_api.c | 2 +-
net/socket.c | 2 +-
net/sunrpc/auth.c | 2 --
19 files changed, 23 insertions(+), 43 deletions(-)
--- everything.orig/net/bluetooth/af_bluetooth.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/bluetooth/af_bluetooth.c 2008-07-08 18:36:06.000000000 +0200
@@ -36,10 +36,7 @@
#include <linux/init.h>
#include <linux/poll.h>
#include <net/sock.h>
-
-#if defined(CONFIG_KMOD)
#include <linux/kmod.h>
-#endif
#include <net/bluetooth/bluetooth.h>
@@ -144,11 +141,8 @@ static int bt_sock_create(struct net *ne
if (proto < 0 || proto >= BT_MAX_PROTO)
return -EINVAL;
-#if defined(CONFIG_KMOD)
- if (!bt_proto[proto]) {
+ if (!bt_proto[proto])
request_module("bt-proto-%d", proto);
- }
-#endif
err = -EPROTONOSUPPORT;
--- everything.orig/net/bridge/netfilter/ebtables.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/bridge/netfilter/ebtables.c 2008-07-08 18:36:06.000000000 +0200
@@ -288,23 +288,14 @@ find_inlist_lock_noload(struct list_head
return NULL;
}
-#ifndef CONFIG_KMOD
-#define find_inlist_lock(h,n,p,e,m) find_inlist_lock_noload((h),(n),(e),(m))
-#else
static void *
find_inlist_lock(struct list_head *head, const char *name, const char *prefix,
int *error, struct mutex *mutex)
{
- void *ret;
-
- ret = find_inlist_lock_noload(head, name, error, mutex);
- if (!ret) {
- request_module("%s%s", prefix, name);
- ret = find_inlist_lock_noload(head, name, error, mutex);
- }
- return ret;
+ return try_then_request_module(
+ find_inlist_lock_noload(head, name, error, mutex),
+ "%s%s", prefix, name);
}
-#endif
static inline struct ebt_table *
find_table_lock(const char *name, int *error, struct mutex *mutex)
--- everything.orig/net/can/af_can.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/can/af_can.c 2008-07-08 18:36:06.000000000 +0200
@@ -128,8 +128,8 @@ static int can_create(struct net *net, s
if (net != &init_net)
return -EAFNOSUPPORT;
-#ifdef CONFIG_KMOD
- /* try to load protocol module, when CONFIG_KMOD is defined */
+#ifdef CONFIG_MODULES
+ /* try to load protocol module kernel is modular */
if (!proto_tab[protocol]) {
err = request_module("can-proto-%d", protocol);
--- everything.orig/net/core/dev.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/core/dev.c 2008-07-08 18:36:06.000000000 +0200
@@ -4639,7 +4639,7 @@ EXPORT_SYMBOL(br_fdb_get_hook);
EXPORT_SYMBOL(br_fdb_put_hook);
#endif
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
EXPORT_SYMBOL(dev_load);
#endif
--- everything.orig/net/core/rtnetlink.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/core/rtnetlink.c 2008-07-08 18:36:06.000000000 +0200
@@ -1029,7 +1029,7 @@ static int rtnl_newlink(struct sk_buff *
struct nlattr *linkinfo[IFLA_INFO_MAX+1];
int err;
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
replay:
#endif
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
@@ -1118,7 +1118,7 @@ replay:
return -EOPNOTSUPP;
if (!ops) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
if (kind[0]) {
__rtnl_unlock();
request_module("rtnl-link-%s", kind);
--- everything.orig/net/dccp/ccid.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/dccp/ccid.c 2008-07-08 18:36:06.000000000 +0200
@@ -154,7 +154,7 @@ struct ccid *ccid_new(unsigned char id,
struct ccid *ccid = NULL;
ccids_read_lock();
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
if (ccids[id] == NULL) {
/* We only try to load if in process context */
ccids_read_unlock();
--- everything.orig/net/decnet/dn_dev.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/decnet/dn_dev.c 2008-07-08 18:36:06.000000000 +0200
@@ -490,9 +490,7 @@ int dn_dev_ioctl(unsigned int cmd, void
return -EFAULT;
ifr->ifr_name[IFNAMSIZ-1] = 0;
-#ifdef CONFIG_KMOD
dev_load(&init_net, ifr->ifr_name);
-#endif
switch(cmd) {
case SIOCGIFADDR:
--- everything.orig/net/ipv4/devinet.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/ipv4/devinet.c 2008-07-08 18:36:06.000000000 +0200
@@ -613,9 +613,7 @@ int devinet_ioctl(struct net *net, unsig
if (colon)
*colon = 0;
-#ifdef CONFIG_KMOD
dev_load(net, ifr.ifr_name);
-#endif
switch (cmd) {
case SIOCGIFADDR: /* Get interface address */
--- everything.orig/net/ipv4/inet_diag.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/ipv4/inet_diag.c 2008-07-08 18:36:06.000000000 +0200
@@ -55,11 +55,9 @@ static DEFINE_MUTEX(inet_diag_table_mute
static const struct inet_diag_handler *inet_diag_lock_handler(int type)
{
-#ifdef CONFIG_KMOD
if (!inet_diag_table[type])
request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
NETLINK_INET_DIAG, type);
-#endif
mutex_lock(&inet_diag_table_mutex);
if (!inet_diag_table[type])
--- everything.orig/net/ipv4/tcp_cong.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/ipv4/tcp_cong.c 2008-07-08 18:36:06.000000000 +0200
@@ -115,7 +115,7 @@ int tcp_set_default_congestion_control(c
spin_lock(&tcp_cong_list_lock);
ca = tcp_ca_find(name);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
if (!ca && capable(CAP_SYS_MODULE)) {
spin_unlock(&tcp_cong_list_lock);
@@ -244,7 +244,7 @@ int tcp_set_congestion_control(struct so
if (ca == icsk->icsk_ca_ops)
goto out;
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
/* not found attempt to autoload module */
if (!ca && capable(CAP_SYS_MODULE)) {
rcu_read_unlock();
--- everything.orig/net/netfilter/nfnetlink.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/netfilter/nfnetlink.c 2008-07-08 18:36:06.000000000 +0200
@@ -134,7 +134,7 @@ static int nfnetlink_rcv_msg(struct sk_b
type = nlh->nlmsg_type;
ss = nfnetlink_get_subsys(type);
if (!ss) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
nfnl_unlock();
request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
nfnl_lock();
--- everything.orig/net/netlink/af_netlink.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/netlink/af_netlink.c 2008-07-08 18:36:06.000000000 +0200
@@ -434,7 +434,7 @@ static int netlink_create(struct net *ne
return -EPROTONOSUPPORT;
netlink_lock_table();
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
if (!nl_table[protocol].registered) {
netlink_unlock_table();
request_module("net-pf-%d-proto-%d", PF_NETLINK, protocol);
--- everything.orig/net/sched/act_api.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/sched/act_api.c 2008-07-08 18:36:06.000000000 +0200
@@ -495,7 +495,7 @@ struct tc_action *tcf_action_init_1(stru
a_o = tc_lookup_action_n(act_name);
if (a_o == NULL) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
rtnl_unlock();
request_module("act_%s", act_name);
rtnl_lock();
--- everything.orig/net/sched/cls_api.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/sched/cls_api.c 2008-07-08 18:36:06.000000000 +0200
@@ -223,7 +223,7 @@ replay:
err = -ENOENT;
tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND]);
if (tp_ops == NULL) {
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
struct nlattr *kind = tca[TCA_KIND];
char name[IFNAMSIZ];
--- everything.orig/net/sched/ematch.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/sched/ematch.c 2008-07-08 18:36:06.000000000 +0200
@@ -224,7 +224,7 @@ static int tcf_em_validate(struct tcf_pr
if (em->ops == NULL) {
err = -ENOENT;
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
__rtnl_unlock();
request_module("ematch-kind-%u", em_hdr->kind);
rtnl_lock();
--- everything.orig/net/sched/sch_api.c 2008-07-08 18:35:54.000000000 +0200
+++ everything/net/sched/sch_api.c 2008-07-08 18:36:06.000000000 +0200
@@ -457,7 +457,7 @@ qdisc_create(struct net_device *dev, u32
struct Qdisc_ops *ops;
ops = qdisc_lookup_ops(kind);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
if (ops == NULL && kind != NULL) {
char name[IFNAMSIZ];
if (nla_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
--- everything.orig/net/socket.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/socket.c 2008-07-08 18:36:06.000000000 +0200
@@ -1140,7 +1140,7 @@ static int __sock_create(struct net *net
sock->type = type;
-#if defined(CONFIG_KMOD)
+#ifdef CONFIG_MODULES
/* Attempt to load a protocol module if the find failed.
*
* 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
--- everything.orig/net/sunrpc/auth.c 2008-07-08 18:35:53.000000000 +0200
+++ everything/net/sunrpc/auth.c 2008-07-08 18:36:06.000000000 +0200
@@ -83,10 +83,8 @@ rpcauth_create(rpc_authflavor_t pseudofl
if (flavor >= RPC_AUTH_MAXFLAVOR)
goto out;
-#ifdef CONFIG_KMOD
if ((ops = auth_flavors[flavor]) == NULL)
request_module("rpc-auth-%u", flavor);
-#endif
spin_lock(&rpc_authflavor_lock);
ops = auth_flavors[flavor];
if (ops == NULL || !try_module_get(ops->owner)) {
--- everything.orig/include/linux/netdevice.h 2008-07-08 18:35:53.000000000 +0200
+++ everything/include/linux/netdevice.h 2008-07-08 18:36:06.000000000 +0200
@@ -1484,8 +1484,11 @@ extern void dev_set_promiscuity(struct
extern void dev_set_allmulti(struct net_device *dev, int inc);
extern void netdev_state_change(struct net_device *dev);
extern void netdev_features_change(struct net_device *dev);
-/* Load a device via the kmod */
+#ifdef CONFIG_MODULES
extern void dev_load(struct net *net, const char *name);
+#else
+static inline void dev_load(struct net *net, const char *name) {};
+#endif
extern void dev_mcast_init(void);
extern int netdev_max_backlog;
extern int weight_p;
--
next prev parent reply other threads:[~2008-07-08 17:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 17:00 [RFC 00/11] CONFIG_KMOD removal Johannes Berg
2008-07-08 17:00 ` [RFC 01/11] make CONFIG_KMOD invisible Johannes Berg
2008-07-08 17:00 ` [RFC 02/11] remove CONFIG_KMOD from core kernel code Johannes Berg
2008-07-08 17:00 ` [RFC 03/11] rework try_then_request_module to do less in non-modular kernels Johannes Berg
2008-07-08 17:00 ` [RFC 04/11] remove CONFIG_KMOD from drivers Johannes Berg
2008-07-08 17:00 ` Johannes Berg
2008-07-08 18:30 ` Adrian Bunk
2008-07-08 18:30 ` Adrian Bunk
2008-07-08 18:30 ` Adrian Bunk
2008-07-08 17:00 ` [RFC 05/11] remove CONFIG_KMOD from sparc64 Johannes Berg
2008-07-08 17:00 ` [RFC 06/11] remove CONFIG_KMOD from fs Johannes Berg
2008-07-08 19:57 ` Adrian Bunk
2008-07-08 20:09 ` Johannes Berg
2008-07-08 20:11 ` Johannes Berg
2008-07-08 17:00 ` [RFC 07/11] remove CONFIG_KMOD from sound Johannes Berg
2008-07-08 18:30 ` Adrian Bunk
2008-07-08 18:38 ` Johannes Berg
2008-07-08 17:00 ` Johannes Berg [this message]
2008-07-08 18:30 ` [RFC 08/11] remove CONFIG_KMOD from net Adrian Bunk
2008-07-08 18:37 ` Johannes Berg
2008-07-08 18:40 ` Adrian Bunk
2008-07-08 18:42 ` Johannes Berg
2008-07-08 17:00 ` [RFC 09/11] remove CONFIG_KMOD from lib Johannes Berg
2008-07-08 17:00 ` [RFC 10/11] remove mention of CONFIG_KMOD from documentation Johannes Berg
2008-07-08 23:29 ` Randy Dunlap
2008-07-08 17:00 ` [RFC 11/11] remove CONFIG_KMOD Johannes Berg
2008-07-09 2:04 ` [RFC 00/11] CONFIG_KMOD removal Rusty Russell
2008-07-09 7:41 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080708170047.433712000@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.