You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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:
+2
-14
@@ -65,22 +65,10 @@ static int xfrm_statistics_seq_show(struct seq_file *seq, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int xfrm_statistics_seq_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open_net(inode, file, xfrm_statistics_seq_show);
|
||||
}
|
||||
|
||||
static const struct file_operations xfrm_statistics_seq_fops = {
|
||||
.open = xfrm_statistics_seq_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release_net,
|
||||
};
|
||||
|
||||
int __net_init xfrm_proc_init(struct net *net)
|
||||
{
|
||||
if (!proc_create("xfrm_stat", 0444, net->proc_net,
|
||||
&xfrm_statistics_seq_fops))
|
||||
if (!proc_create_net_single("xfrm_stat", 0444, net->proc_net,
|
||||
xfrm_statistics_seq_show, NULL))
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user