summaryrefslogtreecommitdiff
path: root/net/kcm
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-13 20:38:35 +0200
committerChristoph Hellwig <hch@lst.de>2018-05-16 07:24:30 +0200
commit3617d9496cd92dcca4d0893191d95554590d8d9f (patch)
tree3054a4c965a42aa4375b08f92b111e1943cd41c5 /net/kcm
parentc3506372277779fccbffee2475400fcd689d5738 (diff)
downloadlwn-3617d9496cd92dcca4d0893191d95554590d8d9f.tar.gz
lwn-3617d9496cd92dcca4d0893191d95554590d8d9f.zip
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>
Diffstat (limited to 'net/kcm')
-rw-r--r--net/kcm/kcmproc.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/net/kcm/kcmproc.c b/net/kcm/kcmproc.c
index 6283ed2f43b2..370da2f80e3c 100644
--- a/net/kcm/kcmproc.c
+++ b/net/kcm/kcmproc.c
@@ -345,22 +345,10 @@ static int kcm_stats_seq_show(struct seq_file *seq, void *v)
return 0;
}
-static int kcm_stats_seq_open(struct inode *inode, struct file *file)
-{
- return single_open_net(inode, file, kcm_stats_seq_show);
-}
-
-static const struct file_operations kcm_stats_seq_fops = {
- .open = kcm_stats_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release_net,
-};
-
static int kcm_proc_init_net(struct net *net)
{
- if (!proc_create("kcm_stats", 0444, net->proc_net,
- &kcm_stats_seq_fops))
+ if (!proc_create_net_single("kcm_stats", 0444, net->proc_net,
+ kcm_stats_seq_show, NULL))
goto out_kcm_stats;
if (!proc_create_net("kcm", 0444, net->proc_net, &kcm_seq_ops,