|
@@ -59,17 +59,18 @@ fold_field(void *mib[], int offt)
|
|
|
|
|
|
static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
|
|
static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
|
|
{
|
|
{
|
|
|
|
+ struct net *net = seq->private;
|
|
int i;
|
|
int i;
|
|
for (i=0; xfrm_mib_list[i].name; i++)
|
|
for (i=0; xfrm_mib_list[i].name; i++)
|
|
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
|
|
seq_printf(seq, "%-24s\t%lu\n", xfrm_mib_list[i].name,
|
|
- fold_field((void **)init_net.mib.xfrm_statistics,
|
|
|
|
|
|
+ fold_field((void **)net->mib.xfrm_statistics,
|
|
xfrm_mib_list[i].entry));
|
|
xfrm_mib_list[i].entry));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int xfrm_statistics_seq_open(struct inode *inode, struct file *file)
|
|
static int xfrm_statistics_seq_open(struct inode *inode, struct file *file)
|
|
{
|
|
{
|
|
- return single_open(file, xfrm_statistics_seq_show, NULL);
|
|
|
|
|
|
+ return single_open_net(inode, file, xfrm_statistics_seq_show);
|
|
}
|
|
}
|
|
|
|
|
|
static struct file_operations xfrm_statistics_seq_fops = {
|
|
static struct file_operations xfrm_statistics_seq_fops = {
|
|
@@ -77,21 +78,18 @@ static struct file_operations xfrm_statistics_seq_fops = {
|
|
.open = xfrm_statistics_seq_open,
|
|
.open = xfrm_statistics_seq_open,
|
|
.read = seq_read,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.llseek = seq_lseek,
|
|
- .release = single_release,
|
|
|
|
|
|
+ .release = single_release_net,
|
|
};
|
|
};
|
|
|
|
|
|
-int __init xfrm_proc_init(void)
|
|
|
|
|
|
+int __net_init xfrm_proc_init(struct net *net)
|
|
{
|
|
{
|
|
- int rc = 0;
|
|
|
|
-
|
|
|
|
- if (!proc_net_fops_create(&init_net, "xfrm_stat", S_IRUGO,
|
|
|
|
|
|
+ if (!proc_net_fops_create(net, "xfrm_stat", S_IRUGO,
|
|
&xfrm_statistics_seq_fops))
|
|
&xfrm_statistics_seq_fops))
|
|
- goto stat_fail;
|
|
|
|
-
|
|
|
|
- out:
|
|
|
|
- return rc;
|
|
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
|
|
- stat_fail:
|
|
|
|
- rc = -ENOMEM;
|
|
|
|
- goto out;
|
|
|
|
|
|
+void xfrm_proc_fini(struct net *net)
|
|
|
|
+{
|
|
|
|
+ proc_net_remove(net, "xfrm_stat");
|
|
}
|
|
}
|