diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-13 14:38:35 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 01:24:30 -0400 |
commit | 3617d9496cd92dcca4d0893191d95554590d8d9f (patch) | |
tree | 3054a4c965a42aa4375b08f92b111e1943cd41c5 /net/kcm/kcmproc.c | |
parent | c3506372277779fccbffee2475400fcd689d5738 (diff) |
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/kcmproc.c')
-rw-r--r-- | net/kcm/kcmproc.c | 16 |
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) | |||
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | 347 | ||
348 | static int kcm_stats_seq_open(struct inode *inode, struct file *file) | ||
349 | { | ||
350 | return single_open_net(inode, file, kcm_stats_seq_show); | ||
351 | } | ||
352 | |||
353 | static const struct file_operations kcm_stats_seq_fops = { | ||
354 | .open = kcm_stats_seq_open, | ||
355 | .read = seq_read, | ||
356 | .llseek = seq_lseek, | ||
357 | .release = single_release_net, | ||
358 | }; | ||
359 | |||
360 | static int kcm_proc_init_net(struct net *net) | 348 | static int kcm_proc_init_net(struct net *net) |
361 | { | 349 | { |
362 | if (!proc_create("kcm_stats", 0444, net->proc_net, | 350 | if (!proc_create_net_single("kcm_stats", 0444, net->proc_net, |
363 | &kcm_stats_seq_fops)) | 351 | kcm_stats_seq_show, NULL)) |
364 | goto out_kcm_stats; | 352 | goto out_kcm_stats; |
365 | 353 | ||
366 | if (!proc_create_net("kcm", 0444, net->proc_net, &kcm_seq_ops, | 354 | if (!proc_create_net("kcm", 0444, net->proc_net, &kcm_seq_ops, |