Re: linux-next: manual merge of the net-next tree with the vfs tree
From: Christoph Hellwig
Date: Thu May 17 2018 - 01:46:11 EST
> + /* Create a new file under /proc/net/ipconfig */
> + static int ipconfig_proc_net_create(const char *name,
> + const struct file_operations *fops)
> + {
> + char *pname;
> + struct proc_dir_entry *p;
> +
> + if (!ipconfig_dir)
> + return -ENOMEM;
> +
> + pname = kasprintf(GFP_KERNEL, "%s%s", "ipconfig/", name);
> + if (!pname)
> + return -ENOMEM;
> +
> + p = proc_create(pname, 0444, init_net.proc_net, fops);
> + kfree(pname);
> + if (!p)
> + return -ENOMEM;
> +
> + return 0;
This code doesn't exist in the above mentioned commit. But event
without knowing the details of the /proc/net code this looks somewhat
bogus. For one I thought all the /proc/net files should be per-net
namespace. Second the ntp file really should be using proc_create_net,
to handle all that under the hood - with the merge of the VFS
tree it will take a seq_ops, which is what this code really wants
anyway.