mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
[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>
This commit is contained in:
committed by
David S. Miller
parent
07feaebfcc
commit
457c4cbc5a
@@ -17,6 +17,7 @@
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
#include <linux/isdnif.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include "isdn_divert.h"
|
||||
|
||||
|
||||
@@ -284,12 +285,12 @@ divert_dev_init(void)
|
||||
init_waitqueue_head(&rd_queue);
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
isdn_proc_entry = proc_mkdir("net/isdn", NULL);
|
||||
isdn_proc_entry = proc_mkdir("isdn", init_net.proc_net);
|
||||
if (!isdn_proc_entry)
|
||||
return (-1);
|
||||
isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry);
|
||||
if (!isdn_divert_entry) {
|
||||
remove_proc_entry("net/isdn", NULL);
|
||||
remove_proc_entry("isdn", init_net.proc_net);
|
||||
return (-1);
|
||||
}
|
||||
isdn_divert_entry->proc_fops = &isdn_fops;
|
||||
@@ -309,7 +310,7 @@ divert_dev_deinit(void)
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
remove_proc_entry("divert", isdn_proc_entry);
|
||||
remove_proc_entry("net/isdn", NULL);
|
||||
remove_proc_entry("isdn", init_net.proc_net);
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
return (0);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "di_defs.h"
|
||||
@@ -86,7 +87,7 @@ proc_read(char *page, char **start, off_t off, int count, int *eof,
|
||||
|
||||
static int DIVA_INIT_FUNCTION create_proc(void)
|
||||
{
|
||||
proc_net_eicon = proc_mkdir("net/eicon", NULL);
|
||||
proc_net_eicon = proc_mkdir("eicon", init_net.proc_net);
|
||||
|
||||
if (proc_net_eicon) {
|
||||
if ((proc_didd =
|
||||
@@ -102,7 +103,7 @@ static int DIVA_INIT_FUNCTION create_proc(void)
|
||||
static void remove_proc(void)
|
||||
{
|
||||
remove_proc_entry(DRIVERLNAME, proc_net_eicon);
|
||||
remove_proc_entry("net/eicon", NULL);
|
||||
remove_proc_entry("eicon", init_net.proc_net);
|
||||
}
|
||||
|
||||
static int DIVA_INIT_FUNCTION divadidd_init(void)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include "hysdn_defs.h"
|
||||
|
||||
@@ -392,7 +393,7 @@ hysdn_procconf_init(void)
|
||||
hysdn_card *card;
|
||||
unsigned char conf_name[20];
|
||||
|
||||
hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net);
|
||||
hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, init_net.proc_net);
|
||||
if (!hysdn_proc_entry) {
|
||||
printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n");
|
||||
return (-1);
|
||||
@@ -437,5 +438,5 @@ hysdn_procconf_release(void)
|
||||
card = card->next; /* point to next card */
|
||||
}
|
||||
|
||||
remove_proc_entry(PROC_SUBDIR_NAME, proc_net);
|
||||
remove_proc_entry(PROC_SUBDIR_NAME, init_net.proc_net);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/if_bonding.h>
|
||||
#include <net/route.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include "bonding.h"
|
||||
#include "bond_3ad.h"
|
||||
#include "bond_alb.h"
|
||||
@@ -3144,7 +3145,7 @@ static void bond_create_proc_dir(void)
|
||||
{
|
||||
int len = strlen(DRV_NAME);
|
||||
|
||||
for (bond_proc_dir = proc_net->subdir; bond_proc_dir;
|
||||
for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir;
|
||||
bond_proc_dir = bond_proc_dir->next) {
|
||||
if ((bond_proc_dir->namelen == len) &&
|
||||
!memcmp(bond_proc_dir->name, DRV_NAME, len)) {
|
||||
@@ -3153,7 +3154,7 @@ static void bond_create_proc_dir(void)
|
||||
}
|
||||
|
||||
if (!bond_proc_dir) {
|
||||
bond_proc_dir = proc_mkdir(DRV_NAME, proc_net);
|
||||
bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
|
||||
if (bond_proc_dir) {
|
||||
bond_proc_dir->owner = THIS_MODULE;
|
||||
} else {
|
||||
@@ -3188,7 +3189,7 @@ static void bond_destroy_proc_dir(void)
|
||||
bond_proc_dir->owner = NULL;
|
||||
}
|
||||
} else {
|
||||
remove_proc_entry(DRV_NAME, proc_net);
|
||||
remove_proc_entry(DRV_NAME, init_net.proc_net);
|
||||
bond_proc_dir = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
|
||||
#include <net/ip.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <linux/bpqether.h>
|
||||
|
||||
@@ -594,7 +595,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
|
||||
static int __init bpq_init_driver(void)
|
||||
{
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if (!proc_net_fops_create("bpqether", S_IRUGO, &bpq_info_fops)) {
|
||||
if (!proc_net_fops_create(&init_net, "bpqether", S_IRUGO, &bpq_info_fops)) {
|
||||
printk(KERN_ERR
|
||||
"bpq: cannot create /proc/net/bpqether entry.\n");
|
||||
return -ENOENT;
|
||||
@@ -618,7 +619,7 @@ static void __exit bpq_cleanup_driver(void)
|
||||
|
||||
unregister_netdevice_notifier(&bpq_dev_notifier);
|
||||
|
||||
proc_net_remove("bpqether");
|
||||
proc_net_remove(&init_net, "bpqether");
|
||||
|
||||
rtnl_lock();
|
||||
while (!list_empty(&bpq_devices)) {
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/ax25.h>
|
||||
|
||||
#include <asm/irq.h>
|
||||
@@ -2114,7 +2115,7 @@ static int __init scc_init_driver (void)
|
||||
}
|
||||
rtnl_unlock();
|
||||
|
||||
proc_net_fops_create("z8530drv", 0, &scc_net_seq_fops);
|
||||
proc_net_fops_create(&init_net, "z8530drv", 0, &scc_net_seq_fops);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2169,7 +2170,7 @@ static void __exit scc_cleanup_driver(void)
|
||||
if (Vector_Latch)
|
||||
release_region(Vector_Latch, 1);
|
||||
|
||||
proc_net_remove("z8530drv");
|
||||
proc_net_remove(&init_net, "z8530drv");
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Joerg Reuter <jreuter@yaina.de>");
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/init.h>
|
||||
@@ -1142,7 +1143,7 @@ static int __init yam_init_driver(void)
|
||||
yam_timer.expires = jiffies + HZ / 100;
|
||||
add_timer(&yam_timer);
|
||||
|
||||
proc_net_fops_create("yam", S_IRUGO, &yam_info_fops);
|
||||
proc_net_fops_create(&init_net, "yam", S_IRUGO, &yam_info_fops);
|
||||
return 0;
|
||||
error:
|
||||
while (--i >= 0) {
|
||||
@@ -1174,7 +1175,7 @@ static void __exit yam_cleanup_driver(void)
|
||||
kfree(p);
|
||||
}
|
||||
|
||||
proc_net_remove("yam");
|
||||
proc_net_remove(&init_net, "yam");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/hvcall.h>
|
||||
#include <asm/atomic.h>
|
||||
@@ -97,7 +98,7 @@ static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter);
|
||||
static struct kobj_type ktype_veth_pool;
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#define IBMVETH_PROC_DIR "net/ibmveth"
|
||||
#define IBMVETH_PROC_DIR "ibmveth"
|
||||
static struct proc_dir_entry *ibmveth_proc_dir;
|
||||
#endif
|
||||
|
||||
@@ -1091,7 +1092,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev)
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static void ibmveth_proc_register_driver(void)
|
||||
{
|
||||
ibmveth_proc_dir = proc_mkdir(IBMVETH_PROC_DIR, NULL);
|
||||
ibmveth_proc_dir = proc_mkdir(IBMVETH_PROC_DIR, init_net.proc_net);
|
||||
if (ibmveth_proc_dir) {
|
||||
SET_MODULE_OWNER(ibmveth_proc_dir);
|
||||
}
|
||||
@@ -1099,7 +1100,7 @@ static void ibmveth_proc_register_driver(void)
|
||||
|
||||
static void ibmveth_proc_unregister_driver(void)
|
||||
{
|
||||
remove_proc_entry(IBMVETH_PROC_DIR, NULL);
|
||||
remove_proc_entry(IBMVETH_PROC_DIR, init_net.proc_net);
|
||||
}
|
||||
|
||||
static void *ibmveth_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/sock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@@ -1042,7 +1043,7 @@ static int __init pppoe_proc_init(void)
|
||||
{
|
||||
struct proc_dir_entry *p;
|
||||
|
||||
p = create_proc_entry("net/pppoe", S_IRUGO, NULL);
|
||||
p = create_proc_entry("pppoe", S_IRUGO, init_net.proc_net);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1113,7 +1114,7 @@ static void __exit pppoe_exit(void)
|
||||
dev_remove_pack(&pppoes_ptype);
|
||||
dev_remove_pack(&pppoed_ptype);
|
||||
unregister_netdevice_notifier(&pppoe_notifier);
|
||||
remove_proc_entry("net/pppoe", NULL);
|
||||
remove_proc_entry("pppoe", init_net.proc_net);
|
||||
proto_unregister(&pppoe_sk_proto);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
#include <linux/hash.h>
|
||||
#include <linux/sort.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/dst.h>
|
||||
#include <net/ip.h>
|
||||
#include <net/udp.h>
|
||||
@@ -2444,7 +2445,7 @@ static int __init pppol2tp_init(void)
|
||||
goto out_unregister_pppol2tp_proto;
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
pppol2tp_proc = create_proc_entry("pppol2tp", 0, proc_net);
|
||||
pppol2tp_proc = create_proc_entry("pppol2tp", 0, init_net.proc_net);
|
||||
if (!pppol2tp_proc) {
|
||||
err = -ENOMEM;
|
||||
goto out_unregister_pppox_proto;
|
||||
@@ -2469,7 +2470,7 @@ static void __exit pppol2tp_exit(void)
|
||||
unregister_pppox_proto(PX_PROTO_OL2TP);
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
remove_proc_entry("pppol2tp", proc_net);
|
||||
remove_proc_entry("pppol2tp", init_net.proc_net);
|
||||
#endif
|
||||
proto_unregister(&pppol2tp_sk_proto);
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/checksum.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
@@ -250,7 +251,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
|
||||
#if STREAMER_NETWORK_MONITOR
|
||||
#ifdef CONFIG_PROC_FS
|
||||
if (!dev_streamer)
|
||||
create_proc_read_entry("net/streamer_tr", 0, 0,
|
||||
create_proc_read_entry("streamer_tr", 0, init_net.proc_net,
|
||||
streamer_proc_info, NULL);
|
||||
streamer_priv->next = dev_streamer;
|
||||
dev_streamer = streamer_priv;
|
||||
@@ -423,7 +424,7 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev)
|
||||
}
|
||||
}
|
||||
if (!dev_streamer)
|
||||
remove_proc_entry("net/streamer_tr", NULL);
|
||||
remove_proc_entry("streamer_tr", init_net.proc_net);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <net/checksum.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
@@ -268,9 +269,9 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device
|
||||
printk("Olympic: %s registered as: %s\n",olympic_priv->olympic_card_name,dev->name);
|
||||
if (olympic_priv->olympic_network_monitor) { /* Must go after register_netdev as we need the device name */
|
||||
char proc_name[20] ;
|
||||
strcpy(proc_name,"net/olympic_") ;
|
||||
strcpy(proc_name,"olympic_") ;
|
||||
strcat(proc_name,dev->name) ;
|
||||
create_proc_read_entry(proc_name,0,NULL,olympic_proc_info,(void *)dev) ;
|
||||
create_proc_read_entry(proc_name,0,init_net.proc_net,olympic_proc_info,(void *)dev) ;
|
||||
printk("Olympic: Network Monitor information: /proc/%s\n",proc_name);
|
||||
}
|
||||
return 0 ;
|
||||
@@ -1752,9 +1753,9 @@ static void __devexit olympic_remove_one(struct pci_dev *pdev)
|
||||
|
||||
if (olympic_priv->olympic_network_monitor) {
|
||||
char proc_name[20] ;
|
||||
strcpy(proc_name,"net/olympic_") ;
|
||||
strcpy(proc_name,"olympic_") ;
|
||||
strcat(proc_name,dev->name) ;
|
||||
remove_proc_entry(proc_name,NULL);
|
||||
remove_proc_entry(proc_name,init_net.proc_net);
|
||||
}
|
||||
unregister_netdev(dev) ;
|
||||
iounmap(olympic_priv->olympic_mmio) ;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/iw_handler.h>
|
||||
#include <net/ieee80211.h>
|
||||
#include <net/ieee80211_crypt.h>
|
||||
@@ -1093,8 +1094,8 @@ struct proc_dir_entry *hostap_proc;
|
||||
|
||||
static int __init hostap_init(void)
|
||||
{
|
||||
if (proc_net != NULL) {
|
||||
hostap_proc = proc_mkdir("hostap", proc_net);
|
||||
if (init_net.proc_net != NULL) {
|
||||
hostap_proc = proc_mkdir("hostap", init_net.proc_net);
|
||||
if (!hostap_proc)
|
||||
printk(KERN_WARNING "Failed to mkdir "
|
||||
"/proc/net/hostap\n");
|
||||
@@ -1109,7 +1110,7 @@ static void __exit hostap_exit(void)
|
||||
{
|
||||
if (hostap_proc != NULL) {
|
||||
hostap_proc = NULL;
|
||||
remove_proc_entry("hostap", proc_net);
|
||||
remove_proc_entry("hostap", init_net.proc_net);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ static const char StripVersion[] = "1.3A-STUART.CHESHIRE";
|
||||
#include <linux/serialP.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <linux/ip.h>
|
||||
#include <linux/tcp.h>
|
||||
@@ -2787,7 +2788,7 @@ static int __init strip_init_driver(void)
|
||||
/*
|
||||
* Register the status file with /proc
|
||||
*/
|
||||
proc_net_fops_create("strip", S_IFREG | S_IRUGO, &strip_seq_fops);
|
||||
proc_net_fops_create(&init_net, "strip", S_IFREG | S_IRUGO, &strip_seq_fops);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -2809,7 +2810,7 @@ static void __exit strip_exit_driver(void)
|
||||
}
|
||||
|
||||
/* Unregister with the /proc/net file here. */
|
||||
proc_net_remove("strip");
|
||||
proc_net_remove(&init_net, "strip");
|
||||
|
||||
if ((i = tty_unregister_ldisc(N_STRIP)))
|
||||
printk(KERN_ERR "STRIP: can't unregister line discipline (err = %d)\n", i);
|
||||
|
||||
@@ -11,6 +11,7 @@ proc-y += inode.o root.o base.o generic.o array.o \
|
||||
proc_tty.o proc_misc.o
|
||||
|
||||
proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
|
||||
proc-$(CONFIG_NET) += proc_net.o
|
||||
proc-$(CONFIG_PROC_KCORE) += kcore.o
|
||||
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
|
||||
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o
|
||||
|
||||
@@ -16,6 +16,11 @@ extern int proc_sys_init(void);
|
||||
#else
|
||||
static inline void proc_sys_init(void) { }
|
||||
#endif
|
||||
#ifdef CONFIG_NET
|
||||
extern int proc_net_init(void);
|
||||
#else
|
||||
static inline int proc_net_init(void) { return 0; }
|
||||
#endif
|
||||
|
||||
struct vmalloc_info {
|
||||
unsigned long used;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver;
|
||||
struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver;
|
||||
|
||||
static int proc_get_sb(struct file_system_type *fs_type,
|
||||
int flags, const char *dev_name, void *data, struct vfsmount *mnt)
|
||||
@@ -61,8 +61,8 @@ void __init proc_root_init(void)
|
||||
return;
|
||||
}
|
||||
proc_misc_init();
|
||||
proc_net = proc_mkdir("net", NULL);
|
||||
proc_net_stat = proc_mkdir("net/stat", NULL);
|
||||
|
||||
proc_net_init();
|
||||
|
||||
#ifdef CONFIG_SYSVIPC
|
||||
proc_mkdir("sysvipc", NULL);
|
||||
@@ -159,7 +159,5 @@ EXPORT_SYMBOL(create_proc_entry);
|
||||
EXPORT_SYMBOL(remove_proc_entry);
|
||||
EXPORT_SYMBOL(proc_root);
|
||||
EXPORT_SYMBOL(proc_root_fs);
|
||||
EXPORT_SYMBOL(proc_net);
|
||||
EXPORT_SYMBOL(proc_net_stat);
|
||||
EXPORT_SYMBOL(proc_bus);
|
||||
EXPORT_SYMBOL(proc_root_driver);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <linux/magic.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct net;
|
||||
struct completion;
|
||||
|
||||
/*
|
||||
@@ -97,8 +98,6 @@ struct vmcore {
|
||||
|
||||
extern struct proc_dir_entry proc_root;
|
||||
extern struct proc_dir_entry *proc_root_fs;
|
||||
extern struct proc_dir_entry *proc_net;
|
||||
extern struct proc_dir_entry *proc_net_stat;
|
||||
extern struct proc_dir_entry *proc_bus;
|
||||
extern struct proc_dir_entry *proc_root_driver;
|
||||
extern struct proc_dir_entry *proc_root_kcore;
|
||||
@@ -192,36 +191,21 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
|
||||
if (res) res->get_info=get_info;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline struct proc_dir_entry *proc_net_create(const char *name,
|
||||
mode_t mode, get_info_t *get_info)
|
||||
{
|
||||
return create_proc_info_entry(name,mode,proc_net,get_info);
|
||||
}
|
||||
|
||||
static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
|
||||
mode_t mode, const struct file_operations *fops)
|
||||
{
|
||||
struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
|
||||
if (res)
|
||||
res->proc_fops = fops;
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline void proc_net_remove(const char *name)
|
||||
{
|
||||
remove_proc_entry(name,proc_net);
|
||||
}
|
||||
extern struct proc_dir_entry *proc_net_create(struct net *net,
|
||||
const char *name, mode_t mode, get_info_t *get_info);
|
||||
extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
|
||||
const char *name, mode_t mode, const struct file_operations *fops);
|
||||
extern void proc_net_remove(struct net *net, const char *name);
|
||||
|
||||
#else
|
||||
|
||||
#define proc_root_driver NULL
|
||||
#define proc_net NULL
|
||||
#define proc_bus NULL
|
||||
|
||||
#define proc_net_fops_create(name, mode, fops) ({ (void)(mode), NULL; })
|
||||
#define proc_net_create(name, mode, info) ({ (void)(mode), NULL; })
|
||||
static inline void proc_net_remove(const char *name) {}
|
||||
#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
|
||||
#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
|
||||
static inline void proc_net_remove(struct net *net, const char *name) {}
|
||||
|
||||
static inline void proc_flush_task(struct task_struct *task) { }
|
||||
|
||||
@@ -281,6 +265,16 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
|
||||
return PROC_I(inode)->pde;
|
||||
}
|
||||
|
||||
static inline struct net *PDE_NET(struct proc_dir_entry *pde)
|
||||
{
|
||||
return pde->parent->data;
|
||||
}
|
||||
|
||||
static inline struct net *PROC_NET(const struct inode *inode)
|
||||
{
|
||||
return PDE_NET(PDE(inode));
|
||||
}
|
||||
|
||||
struct proc_maps_private {
|
||||
struct pid *pid;
|
||||
struct task_struct *task;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
struct proc_dir_entry;
|
||||
struct net {
|
||||
atomic_t count; /* To decided when the network
|
||||
* namespace should be freed.
|
||||
@@ -17,6 +18,10 @@ struct net {
|
||||
*/
|
||||
struct list_head list; /* list of network namespaces */
|
||||
struct work_struct work; /* work struct for freeing */
|
||||
|
||||
struct proc_dir_entry *proc_net;
|
||||
struct proc_dir_entry *proc_net_stat;
|
||||
struct proc_dir_entry *proc_net_root;
|
||||
};
|
||||
|
||||
extern struct net init_net;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/init.h>
|
||||
#include <net/arp.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev);
|
||||
static void rif_check_expire(unsigned long dummy);
|
||||
@@ -639,7 +640,7 @@ static int __init rif_init(void)
|
||||
rif_timer.function = rif_check_expire;
|
||||
add_timer(&rif_timer);
|
||||
|
||||
proc_net_fops_create("tr_rif", S_IRUGO, &rif_seq_fops);
|
||||
proc_net_fops_create(&init_net, "tr_rif", S_IRUGO, &rif_seq_fops);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user