summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-01-29 01:41:54 +0000
commitf969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch)
treeb3530d803df59d726afaabebc6626987dee1ca05 /net/core
parenta10ce7ef2066b455d69187643ddf2073bfc4db24 (diff)
Merge with 2.3.27.
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c113
-rw-r--r--net/core/dev_mcast.c5
-rw-r--r--net/core/profile.c5
3 files changed, 26 insertions, 97 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 078caeb99..612a14d5c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -354,14 +354,18 @@ struct net_device *dev_getbyhwaddr(unsigned short type, char *ha)
int dev_alloc_name(struct net_device *dev, const char *name)
{
int i;
+ char buf[32];
/*
* If you need over 100 please also fix the algorithm...
*/
for(i=0;i<100;i++)
{
- sprintf(dev->name,name,i);
- if(__dev_get_by_name(dev->name)==NULL)
+ sprintf(buf,name,i);
+ if(__dev_get_by_name(buf)==NULL)
+ {
+ strcpy(dev->name, buf);
return i;
+ }
}
return -ENFILE; /* Over 100 of the things .. bail out! */
}
@@ -1994,39 +1998,9 @@ int unregister_netdevice(struct net_device *dev)
* present) and leaves us with a valid list of present and active devices.
*
*/
-extern int lance_init(void);
-extern int bpq_init(void);
-extern int scc_init(void);
-extern void sdla_setup(void);
-extern void dlci_setup(void);
-extern int dmascc_init(void);
-
-extern int lapbeth_init(void);
-extern void arcnet_init(void);
-extern void ip_auto_config(void);
-#ifdef CONFIG_8xx
-extern int cpm_enet_init(void);
-#endif /* CONFIG_8xx */
-#ifdef CONFIG_PROC_FS
-static struct proc_dir_entry proc_net_dev = {
- PROC_NET_DEV, 3, "dev",
- S_IFREG | S_IRUGO, 1, 0, 0,
- 0, &proc_net_inode_operations,
- dev_get_info
-};
-#endif
-
-#ifdef CONFIG_NET_RADIO
-#ifdef CONFIG_PROC_FS
-static struct proc_dir_entry proc_net_wireless = {
- PROC_NET_WIRELESS, 8, "wireless",
- S_IFREG | S_IRUGO, 1, 0, 0,
- 0, &proc_net_inode_operations,
- dev_get_wireless_info
-};
-#endif /* CONFIG_PROC_FS */
-#endif /* CONFIG_NET_RADIO */
+extern void net_device_init(void);
+extern void ip_auto_config(void);
int __init net_dev_init(void)
{
@@ -2050,51 +2024,6 @@ int __init net_dev_init(void)
br_init();
#endif
- /*
- * This is Very Ugly(tm).
- *
- * Some devices want to be initialized early..
- */
-
-#if defined(CONFIG_SCC)
- scc_init();
-#endif
-#if defined(CONFIG_DMASCC)
- dmascc_init();
-#endif
-#if defined(CONFIG_BPQETHER)
- bpq_init();
-#endif
-#if defined(CONFIG_DLCI)
- dlci_setup();
-#endif
-#if defined(CONFIG_SDLA)
- sdla_setup();
-#endif
-#if defined(CONFIG_LAPBETHER)
- lapbeth_init();
-#endif
-#if defined(CONFIG_PLIP)
- plip_init();
-#endif
-#if defined(CONFIG_ARCNET)
- arcnet_init();
-#endif
-#if defined(CONFIG_8xx)
- cpm_enet_init();
-#endif
- /*
- * SLHC if present needs attaching so other people see it
- * even if not opened.
- */
-
-#ifdef CONFIG_INET
-#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
- || defined(CONFIG_PPP) \
- || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
- slhc_install();
-#endif
-#endif
#ifdef CONFIG_NET_PROFILE
net_profile_init();
@@ -2121,6 +2050,12 @@ int __init net_dev_init(void)
dev->xmit_lock_owner = -1;
dev->iflink = -1;
dev_hold(dev);
+ /*
+ * We can allocate the name ahead of time. If the
+ * init fails the name will be reissued correctly.
+ */
+ if (strchr(dev->name, '%'))
+ dev_alloc_name(dev, dev->name);
if (dev->init && dev->init(dev)) {
/*
* It failed to come up. Unhook it.
@@ -2142,18 +2077,12 @@ int __init net_dev_init(void)
}
#ifdef CONFIG_PROC_FS
- proc_net_register(&proc_net_dev);
- {
- struct proc_dir_entry *ent = create_proc_entry("net/dev_stat", 0, 0);
- ent->read_proc = dev_proc_stats;
- }
-#endif
-
+ proc_net_create("dev", 0, dev_get_info);
+ create_proc_read_entry("net/dev_stat", 0, 0, dev_proc_stats, NULL);
#ifdef CONFIG_NET_RADIO
-#ifdef CONFIG_PROC_FS
- proc_net_register(&proc_net_wireless);
-#endif /* CONFIG_PROC_FS */
+ proc_net_create("wireless", 0, dev_get_wireless_info);
#endif /* CONFIG_NET_RADIO */
+#endif /* CONFIG_PROC_FS */
init_bh(NET_BH, net_bh);
@@ -2162,6 +2091,12 @@ int __init net_dev_init(void)
dst_init();
dev_mcast_init();
+ /*
+ * Initialise network devices
+ */
+
+ net_device_init();
+
#ifdef CONFIG_IP_PNP
ip_auto_config();
#endif
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index c52df0507..2facf1bc1 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -258,10 +258,7 @@ done:
void __init dev_mcast_init(void)
{
#ifdef CONFIG_PROC_FS
- struct proc_dir_entry *ent;
-
- ent = create_proc_entry("net/dev_mcast", 0, 0);
- ent->read_proc = dev_mc_read_proc;
+ create_proc_read_entry("net/dev_mcast", 0, 0, dev_mc_read_proc, NULL);
#endif
}
diff --git a/net/core/profile.c b/net/core/profile.c
index e43a3d6e1..8b2616c50 100644
--- a/net/core/profile.c
+++ b/net/core/profile.c
@@ -265,10 +265,7 @@ int __init net_profile_init(void)
int i;
#ifdef CONFIG_PROC_FS
- struct proc_dir_entry *ent;
-
- ent = create_proc_entry("net/profile", 0, 0);
- ent->read_proc = profile_read_proc;
+ create_proc_read_entry("net/profile", 0, 0, profile_read_proc, NULL);
#endif
register_netdevice(&whitehole_dev);