diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2007-09-12 06:01:34 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:06 -0400 |
commit | 457c4cbc5a3dde259d2a1f15d5f9785290397267 (patch) | |
tree | a2ceee88780cbce27433b9a4434b3e9251efd81a /drivers/net/tokenring | |
parent | 07feaebfcc10cd35e745c7073667935246494bee (diff) |
[NET]: Make /proc/net per network namespace
This patch makes /proc/net per network namespace. It modifies the global
variables proc_net and proc_net_stat to be per network namespace.
The proc_net file helpers are modified to take a network namespace argument,
and all of their callers are fixed to pass &init_net for that argument.
This ensures that all of the /proc/net files are only visible and
usable in the initial network namespace until the code behind them
has been updated to be handle multiple network namespaces.
Making /proc/net per namespace is necessary as at least some files
in /proc/net depend upon the set of network devices which is per
network namespace, and even more files in /proc/net have contents
that are relevant to a single network namespace.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tokenring')
-rw-r--r-- | drivers/net/tokenring/lanstreamer.c | 5 | ||||
-rw-r--r-- | drivers/net/tokenring/olympic.c | 9 |
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/tokenring/lanstreamer.c b/drivers/net/tokenring/lanstreamer.c index 5d849c089a3b..fc4495581f96 100644 --- a/drivers/net/tokenring/lanstreamer.c +++ b/drivers/net/tokenring/lanstreamer.c | |||
@@ -123,6 +123,7 @@ | |||
123 | #include <linux/bitops.h> | 123 | #include <linux/bitops.h> |
124 | #include <linux/jiffies.h> | 124 | #include <linux/jiffies.h> |
125 | 125 | ||
126 | #include <net/net_namespace.h> | ||
126 | #include <net/checksum.h> | 127 | #include <net/checksum.h> |
127 | 128 | ||
128 | #include <asm/io.h> | 129 | #include <asm/io.h> |
@@ -250,7 +251,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, | |||
250 | #if STREAMER_NETWORK_MONITOR | 251 | #if STREAMER_NETWORK_MONITOR |
251 | #ifdef CONFIG_PROC_FS | 252 | #ifdef CONFIG_PROC_FS |
252 | if (!dev_streamer) | 253 | if (!dev_streamer) |
253 | create_proc_read_entry("net/streamer_tr", 0, 0, | 254 | create_proc_read_entry("streamer_tr", 0, init_net.proc_net, |
254 | streamer_proc_info, NULL); | 255 | streamer_proc_info, NULL); |
255 | streamer_priv->next = dev_streamer; | 256 | streamer_priv->next = dev_streamer; |
256 | dev_streamer = streamer_priv; | 257 | dev_streamer = streamer_priv; |
@@ -423,7 +424,7 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev) | |||
423 | } | 424 | } |
424 | } | 425 | } |
425 | if (!dev_streamer) | 426 | if (!dev_streamer) |
426 | remove_proc_entry("net/streamer_tr", NULL); | 427 | remove_proc_entry("streamer_tr", init_net.proc_net); |
427 | } | 428 | } |
428 | #endif | 429 | #endif |
429 | #endif | 430 | #endif |
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c index 09b3cfb8e809..c323101a895b 100644 --- a/drivers/net/tokenring/olympic.c +++ b/drivers/net/tokenring/olympic.c | |||
@@ -102,6 +102,7 @@ | |||
102 | #include <linux/jiffies.h> | 102 | #include <linux/jiffies.h> |
103 | 103 | ||
104 | #include <net/checksum.h> | 104 | #include <net/checksum.h> |
105 | #include <net/net_namespace.h> | ||
105 | 106 | ||
106 | #include <asm/io.h> | 107 | #include <asm/io.h> |
107 | #include <asm/system.h> | 108 | #include <asm/system.h> |
@@ -268,9 +269,9 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device | |||
268 | printk("Olympic: %s registered as: %s\n",olympic_priv->olympic_card_name,dev->name); | 269 | printk("Olympic: %s registered as: %s\n",olympic_priv->olympic_card_name,dev->name); |
269 | if (olympic_priv->olympic_network_monitor) { /* Must go after register_netdev as we need the device name */ | 270 | if (olympic_priv->olympic_network_monitor) { /* Must go after register_netdev as we need the device name */ |
270 | char proc_name[20] ; | 271 | char proc_name[20] ; |
271 | strcpy(proc_name,"net/olympic_") ; | 272 | strcpy(proc_name,"olympic_") ; |
272 | strcat(proc_name,dev->name) ; | 273 | strcat(proc_name,dev->name) ; |
273 | create_proc_read_entry(proc_name,0,NULL,olympic_proc_info,(void *)dev) ; | 274 | create_proc_read_entry(proc_name,0,init_net.proc_net,olympic_proc_info,(void *)dev) ; |
274 | printk("Olympic: Network Monitor information: /proc/%s\n",proc_name); | 275 | printk("Olympic: Network Monitor information: /proc/%s\n",proc_name); |
275 | } | 276 | } |
276 | return 0 ; | 277 | return 0 ; |
@@ -1752,9 +1753,9 @@ static void __devexit olympic_remove_one(struct pci_dev *pdev) | |||
1752 | 1753 | ||
1753 | if (olympic_priv->olympic_network_monitor) { | 1754 | if (olympic_priv->olympic_network_monitor) { |
1754 | char proc_name[20] ; | 1755 | char proc_name[20] ; |
1755 | strcpy(proc_name,"net/olympic_") ; | 1756 | strcpy(proc_name,"olympic_") ; |
1756 | strcat(proc_name,dev->name) ; | 1757 | strcat(proc_name,dev->name) ; |
1757 | remove_proc_entry(proc_name,NULL); | 1758 | remove_proc_entry(proc_name,init_net.proc_net); |
1758 | } | 1759 | } |
1759 | unregister_netdev(dev) ; | 1760 | unregister_netdev(dev) ; |
1760 | iounmap(olympic_priv->olympic_mmio) ; | 1761 | iounmap(olympic_priv->olympic_mmio) ; |