> + if (task != NULL) {
> + ns = task_nsproxy(task);
> + if (ns != NULL)
> + net = get_net(ns->net_ns);
> + }
> + rcu_read_unlock();
> +
> + return net;
> +}
> +
> +static struct dentry *proc_tgid_net_lookup(struct inode *dir,
> + struct dentry *dentry, struct nameidata *nd)
> +{
> + struct dentry *de;
> + struct net *net;
> +
> + de = ERR_PTR(-ENOENT);
> + net = get_proc_task_net(dir);
> + if (net != NULL) {
> + de = proc_lookup_de(net->proc_net, dir, dentry);
> + put_net(net);
> + }
> + return de;
> +}
> +
> +const struct inode_operations proc_net_inode_operations = {
> + .lookup = proc_tgid_net_lookup,
> +};
> +
> +static int proc_tgid_net_readdir(struct file *filp, void *dirent,
> + filldir_t filldir)
> +{
> + int ret;
> + struct net *net;
> +
> + ret = -EINVAL;
> + net = get_proc_task_net(filp->f_path.dentry->d_inode);
> + if (net != NULL) {
> + ret = proc_readdir_de(net->proc_net, filp, dirent, filldir);
> + put_net(net);
> + }
> + return ret;
> +}
> +
> +const struct file_operations proc_net_operations = {
> + .read = generic_read_dir,
> + .readdir = proc_tgid_net_readdir,
> +};
> +
>
> struct proc_dir_entry *proc_net_fops_create(struct net *net,
> const char *name, mode_t mode, const struct file_operations *fops)
> @@ -83,14 +140,6 @@ struct net *get_proc_net(const struct inode *inode)
> }
> EXPORT_SYMBOL_GPL(get_proc_net);
>
> -static struct proc_dir_entry *shadow_pde;
> -
> -static struct proc_dir_entry *proc_net_shadow(struct task_struct *task,
> - struct proc_dir_entry *de)
> -{
> - return task->nsproxy->net_ns->proc_net;
> -}
> -
> struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> struct proc_dir_entry *parent)
> {
> @@ -104,45 +153,35 @@ EXPORT_SYMBOL_GPL(proc_net_mkdir);
>
> static __net_init int proc_net_ns_init(struct net *net)
> {
> - struct proc_dir_entry *root, *netd, *net_statd;
> + struct proc_dir_entry *netd, *net_statd;
> int err;
>
> err = -ENOMEM;
> - root = kzalloc(sizeof(*root), GFP_KERNEL);
> - if (!root)
> + netd = kzalloc(sizeof(*netd), GFP_KERNEL);
> + if (!netd)
> goto out;
>
> - err = -EEXIST;
> - netd = proc_net_mkdir(net, "net", root);
> - if (!netd)
> - goto free_root;
> + netd->data = net;
>
> err = -EEXIST;
> net_statd = proc_net_mkdir(net, "stat", netd);
> if (!net_statd)
> goto free_net;
>
> - root->data = net;
> -
> - net->proc_net_root = root;
> net->proc_net = netd;
> net->proc_net_stat = net_statd;
> - err = 0;
> + return 0;
>
> +free_net:
> + kfree(netd);
> out:
> return err;
> -free_net:
> - remove_proc_entry("net", root);
> -free_root:
> - kfree(root);
> - goto out;
> }
>
> static __net_exit void proc_net_ns_exit(struct net *net)
> {
> remove_proc_entry("stat", net->proc_net);
> - remove_proc_entry("net", net->proc_net_root);
> - kfree(net->proc_net_root);
> + kfree(net->proc_net);
> }
>
> static struct pernet_operations __net_initdata proc_net_ns_ops = {
> @@ -152,8 +191,7 @@ static struct pernet_operations __net_initdata proc_net_ns_ops = {
>
> int __init proc_net_init(void)
> {
> - shadow_pde = proc_mkdir("net", NULL);
> - shadow_pde->shadow_proc = proc_net_shadow;
> + proc_symlink("net", NULL, "self/net");
>
> return register_pernet_subsys(&proc_net_ns_ops);
> }
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index d9a9e71..9b6c935 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -50,8 +50,6 @@ typedef int (read_proc_t)(char *page, char **start, off_t off,
> typedef int (write_proc_t)(struct file *file, const char __user *buffer,
> unsigned long count, void *data);
> typedef int (get_info_t)(char *, char **, off_t, int);
> -typedef struct proc_dir_entry *(shadow_proc_t)(struct task_struct *task,
> - struct proc_dir_entry *pde);
>
> struct proc_dir_entry {
> unsigned int low_ino;
> @@ -82,7 +80,6 @@ struct proc_dir_entry {
> int pde_users; /* number of callers into module in progress */
> spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
> struct completion *pde_unload_completion;
> - shadow_proc_t *shadow_proc;
> };
>
> struct kcore_list {
> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
> index 28738b7..923f2b8 100644
> --- a/include/net/net_namespace.h
> +++ b/include/net/net_namespace.h
> @@ -31,7 +31,6 @@ struct net {
>
> struct proc_dir_entry *proc_net;
> struct proc_dir_entry *proc_net_stat;
> - struct proc_dir_entry *proc_net_root;
>
> struct list_head sysctl_table_headers;
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to
majordomo@vger.kernel.org
> More majordomo info at
http://vger.kernel.org/majordomo-info.html