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:
Christoph Hellwig
2018-04-13 20:38:35 +02:00
parent c350637227
commit 3617d9496c
13 changed files with 86 additions and 307 deletions

View File

@@ -13,9 +13,6 @@ struct seq_net_private {
#endif
};
int single_open_net(struct inode *, struct file *file,
int (*show)(struct seq_file *, void *));
int single_release_net(struct inode *, struct file *);
static inline struct net *seq_file_net(struct seq_file *seq)
{
#ifdef CONFIG_NET_NS
@@ -26,8 +23,8 @@ static inline struct net *seq_file_net(struct seq_file *seq)
}
/*
* This one is needed for single_open_net since net is stored directly in
* private not as a struct i.e. seq_file_net can't be used.
* This one is needed for proc_create_net_single since net is stored directly
* in private not as a struct i.e. seq_file_net can't be used.
*/
static inline struct net *seq_file_single_net(struct seq_file *seq)
{