[Devel] [PATCH RHEL7 COMMIT] vzprivnet: Rework proc structure
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Mar 24 08:53:28 PDT 2016
The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.3
------>
commit 5291af801f9adbed802250b2effdc8f50c24c13e
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date: Thu Mar 24 19:53:28 2016 +0400
vzprivnet: Rework proc structure
Port diff-vz-privnet-rework-proc-layout
vzprivnet: Rework proc structure
All the files are now in /proc/vz/privnet.
Legacy /proc/net/ip_vzprivnet file is a symlink on the
/proc/vz/privnet/legacy one.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
net/ipv4/netfilter/ip_vzprivnet.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/net/ipv4/netfilter/ip_vzprivnet.c b/net/ipv4/netfilter/ip_vzprivnet.c
index 33db6d0..fa64a79 100644
--- a/net/ipv4/netfilter/ip_vzprivnet.c
+++ b/net/ipv4/netfilter/ip_vzprivnet.c
@@ -476,26 +476,48 @@ static struct file_operations proc_vzprivnet_ops = {
.write = vzpriv_write,
};
+static struct proc_dir_entry *vzpriv_proc_dir;
+
static int __init iptable_vzprivnet_init(void)
{
- int err;
+ int err = -ENOMEM;
struct proc_dir_entry *proc;
- proc = proc_net_fops_create(&init_net, VZPRIV_PROCNAME, 0640, &proc_vzprivnet_ops);
- if (!proc)
- return -ENOMEM;
+ vzpriv_proc_dir = proc_mkdir("privnet", proc_vz_dir);
+ if (vzpriv_proc_dir == NULL)
+ goto err_mkdir;
+
+ proc = proc_create("legacy", 0644,
+ vzpriv_proc_dir, &proc_vzprivnet_ops);
+ if (proc == NULL)
+ goto err_legacy;
+
+ proc = proc_symlink(VZPRIV_PROCNAME, init_net.proc_net, "/proc/vz/privnet/legacy");
+ if (proc == NULL)
+ goto err_link;
err = nf_register_hook(&vzprivnet_ops);
if (err)
- proc_net_remove(&init_net, VZPRIV_PROCNAME);
+ goto err_reg;
+
+ return 0;
+err_reg:
+ remove_proc_entry(VZPRIV_PROCNAME, init_net.proc_net);
+err_link:
+ remove_proc_entry("legacy", vzpriv_proc_dir);
+err_legacy:
+ remove_proc_entry("privnet", proc_vz_dir);
+err_mkdir:
return err;
}
static void __exit iptable_vzprivnet_exit(void)
{
nf_unregister_hook(&vzprivnet_ops);
- proc_net_remove(&init_net, VZPRIV_PROCNAME);
+ remove_proc_entry(VZPRIV_PROCNAME, init_net.proc_net);
+ remove_proc_entry("legacy", vzpriv_proc_dir);
+ remove_proc_entry("privnet", proc_vz_dir);
vzprivnet_cleanup();
}
More information about the Devel
mailing list