proc: introduce proc_create_net_single
Variant of proc_create_data that directly take a seq_file show callback and deals with network namespaces in ->open and ->release. All callers of proc_create + single_open_net converted over, and single_{open,release}_net are removed entirely. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -4876,18 +4876,6 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rt6_stats_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open_net(inode, file, rt6_stats_seq_show);
|
||||
}
|
||||
|
||||
static const struct file_operations rt6_stats_seq_fops = {
|
||||
.open = rt6_stats_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release_net,
|
||||
};
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
@@ -5094,7 +5082,8 @@ static int __net_init ip6_route_net_init_late(struct net *net)
|
||||
#ifdef CONFIG_PROC_FS
|
||||
proc_create_net("ipv6_route", 0, net->proc_net, &ipv6_route_seq_ops,
|
||||
sizeof(struct ipv6_route_iter));
|
||||
proc_create("rt6_stats", 0444, net->proc_net, &rt6_stats_seq_fops);
|
||||
proc_create_net_single("rt6_stats", 0444, net->proc_net,
|
||||
rt6_stats_seq_show, NULL);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user