summaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-10 21:31:50 +0200
committerChristoph Hellwig <hch@lst.de>2018-05-16 07:23:35 +0200
commita3d2599b24462c762719a70bc4d2ec8e8cb52fcf (patch)
treea3b5ae4182589c9ee914d4298366377112cb260b /net/ipv6/udp.c
parentproc: introduce proc_create_single{,_data} (diff)
downloadlinux-a3d2599b24462c762719a70bc4d2ec8e8cb52fcf.tar.xz
linux-a3d2599b24462c762719a70bc4d2ec8e8cb52fcf.zip
ipv{4,6}/udp{,lite}: simplify proc registration
Remove a couple indirections to make the code look like most other protocols. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index ea0730028e5d..29adddeac3e5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1480,31 +1480,43 @@ int udp6_seq_show(struct seq_file *seq, void *v)
return 0;
}
-static const struct file_operations udp6_afinfo_seq_fops = {
- .open = udp_seq_open,
+static const struct seq_operations udp6_seq_ops = {
+ .start = udp_seq_start,
+ .next = udp_seq_next,
+ .stop = udp_seq_stop,
+ .show = udp6_seq_show,
+};
+
+static int udp6_seq_open(struct inode *inode, struct file *file)
+{
+ return seq_open_net(inode, file, &udp6_seq_ops,
+ sizeof(struct udp_iter_state));
+}
+
+const struct file_operations udp6_afinfo_seq_fops = {
+ .open = udp6_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_net
};
+EXPORT_SYMBOL(udp6_afinfo_seq_fops);
static struct udp_seq_afinfo udp6_seq_afinfo = {
- .name = "udp6",
.family = AF_INET6,
.udp_table = &udp_table,
- .seq_fops = &udp6_afinfo_seq_fops,
- .seq_ops = {
- .show = udp6_seq_show,
- },
};
int __net_init udp6_proc_init(struct net *net)
{
- return udp_proc_register(net, &udp6_seq_afinfo);
+ if (!proc_create_data("udp6", 0444, net->proc_net,
+ &udp6_afinfo_seq_fops, &udp6_seq_afinfo))
+ return -ENOMEM;
+ return 0;
}
void udp6_proc_exit(struct net *net)
{
- udp_proc_unregister(net, &udp6_seq_afinfo);
+ remove_proc_entry("udp6", net->proc_net);
}
#endif /* CONFIG_PROC_FS */