diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-15 15:57:23 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-16 07:23:35 +0200 |
commit | 3f3942aca6da351a12543aa776467791b63b3a78 (patch) | |
tree | 31030e086ea36920e07078ea2289b9b72c0b2939 /net/ipv6/proc.c | |
parent | 44414d82cfe0f68cb59d0a42f599ccd893ae0032 (diff) | |
download | linux-3f3942aca6da351a12543aa776467791b63b3a78.tar.bz2 |
proc: introduce proc_create_single{,_data}
Variants of proc_create{,_data} that directly take a seq_file show
callback and drastically reduces the boilerplate code in the callers.
All trivial callers converted over.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index a85f7e0b14b1..a0edf194822a 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -267,18 +267,6 @@ static int snmp6_dev_seq_show(struct seq_file *seq, void *v) return 0; } -static int snmp6_dev_seq_open(struct inode *inode, struct file *file) -{ - return single_open(file, snmp6_dev_seq_show, PDE_DATA(inode)); -} - -static const struct file_operations snmp6_dev_seq_fops = { - .open = snmp6_dev_seq_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - int snmp6_register_dev(struct inet6_dev *idev) { struct proc_dir_entry *p; @@ -291,9 +279,8 @@ int snmp6_register_dev(struct inet6_dev *idev) if (!net->mib.proc_net_devsnmp6) return -ENOENT; - p = proc_create_data(idev->dev->name, 0444, - net->mib.proc_net_devsnmp6, - &snmp6_dev_seq_fops, idev); + p = proc_create_single_data(idev->dev->name, 0444, + net->mib.proc_net_devsnmp6, snmp6_dev_seq_show, idev); if (!p) return -ENOMEM; |