aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ping.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-10 20:04:20 +0200
committerChristoph Hellwig <hch@lst.de>2018-05-16 07:23:35 +0200
commitf455022166b57c8693897334508dfa75d3b62b38 (patch)
tree36fee3d300e0d74a0d9984d4781f50feaf64d091 /net/ipv6/ping.c
parentipv{4,6}/tcp: simplify procfs registration (diff)
downloadlinux-dev-f455022166b57c8693897334508dfa75d3b62b38.tar.xz
linux-dev-f455022166b57c8693897334508dfa75d3b62b38.zip
ipv{4,6}/ping: simplify proc file creation
Remove the pointless ping_seq_afinfo indirection and make the code look like most other protocols. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to '')
-rw-r--r--net/ipv6/ping.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
index 746eeae7f581..45d5c8e0f2bf 100644
--- a/net/ipv6/ping.c
+++ b/net/ipv6/ping.c
@@ -24,6 +24,7 @@
#include <net/protocol.h>
#include <net/udp.h>
#include <net/transp_v6.h>
+#include <linux/proc_fs.h>
#include <net/ping.h>
/* Compatibility glue so we can support IPv6 when it's compiled as a module */
@@ -215,26 +216,36 @@ static int ping_v6_seq_show(struct seq_file *seq, void *v)
return 0;
}
-static struct ping_seq_afinfo ping_v6_seq_afinfo = {
- .name = "icmp6",
- .family = AF_INET6,
- .seq_fops = &ping_seq_fops,
- .seq_ops = {
- .start = ping_v6_seq_start,
- .show = ping_v6_seq_show,
- .next = ping_seq_next,
- .stop = ping_seq_stop,
- },
+static const struct seq_operations ping_v6_seq_ops = {
+ .start = ping_v6_seq_start,
+ .show = ping_v6_seq_show,
+ .next = ping_seq_next,
+ .stop = ping_seq_stop,
+};
+
+static int ping_v6_seq_open(struct inode *inode, struct file *file)
+{
+ return seq_open_net(inode, file, &ping_v6_seq_ops,
+ sizeof(struct ping_iter_state));
+}
+
+const struct file_operations ping_v6_seq_fops = {
+ .open = ping_v6_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release_net,
};
static int __net_init ping_v6_proc_init_net(struct net *net)
{
- return ping_proc_register(net, &ping_v6_seq_afinfo);
+ if (!proc_create("icmp6", 0444, net->proc_net, &ping_v6_seq_fops))
+ return -ENOMEM;
+ return 0;
}
static void __net_init ping_v6_proc_exit_net(struct net *net)
{
- return ping_proc_unregister(net, &ping_v6_seq_afinfo);
+ remove_proc_entry("icmp6", net->proc_net);
}
static struct pernet_operations ping_v6_net_ops = {