mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
proc: consolidate per-net single_open callers
There are already 7 of them - time to kill some duplicate code. Signed-off-by: Pavel Emelyanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
60bdde9580
commit
de05c557b2
6 changed files with 33 additions and 108 deletions
|
|
@ -51,6 +51,30 @@ int seq_open_net(struct inode *ino, struct file *f,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(seq_open_net);
|
||||
|
||||
int single_open_net(struct inode *inode, struct file *file,
|
||||
int (*show)(struct seq_file *, void *))
|
||||
{
|
||||
int err;
|
||||
struct net *net;
|
||||
|
||||
err = -ENXIO;
|
||||
net = get_proc_net(inode);
|
||||
if (net == NULL)
|
||||
goto err_net;
|
||||
|
||||
err = single_open(file, show, net);
|
||||
if (err < 0)
|
||||
goto err_open;
|
||||
|
||||
return 0;
|
||||
|
||||
err_open:
|
||||
put_net(net);
|
||||
err_net:
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(single_open_net);
|
||||
|
||||
int seq_release_net(struct inode *ino, struct file *f)
|
||||
{
|
||||
struct seq_file *seq;
|
||||
|
|
|
|||
Loading…
Reference in a new issue