summaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-11 09:31:28 +0200
committerChristoph Hellwig <hch@lst.de>2018-05-16 07:23:35 +0200
commit37d849bb4294e22d5250264e82beaf4dd8a5403c (patch)
tree8f2f81ca47b41241f5372eda7b91ee7e70a193e0 /net/ipv6/tcp_ipv6.c
parentipv{4,6}/udp{,lite}: simplify proc registration (diff)
downloadlinux-37d849bb4294e22d5250264e82beaf4dd8a5403c.tar.xz
linux-37d849bb4294e22d5250264e82beaf4dd8a5403c.zip
ipv{4,6}/tcp: simplify procfs registration
Avoid most of the afinfo indirections and just call the proc helpers directly. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to '')
-rw-r--r--net/ipv6/tcp_ipv6.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 6d664d83cd16..c0329bb1692f 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1909,30 +1909,41 @@ out:
return 0;
}
+static const struct seq_operations tcp6_seq_ops = {
+ .show = tcp6_seq_show,
+ .start = tcp_seq_start,
+ .next = tcp_seq_next,
+ .stop = tcp_seq_stop,
+};
+
+static int tcp6_seq_open(struct inode *inode, struct file *file)
+{
+ return seq_open_net(inode, file, &tcp6_seq_ops,
+ sizeof(struct tcp_iter_state));
+}
+
static const struct file_operations tcp6_afinfo_seq_fops = {
- .open = tcp_seq_open,
+ .open = tcp6_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release_net
};
static struct tcp_seq_afinfo tcp6_seq_afinfo = {
- .name = "tcp6",
.family = AF_INET6,
- .seq_fops = &tcp6_afinfo_seq_fops,
- .seq_ops = {
- .show = tcp6_seq_show,
- },
};
int __net_init tcp6_proc_init(struct net *net)
{
- return tcp_proc_register(net, &tcp6_seq_afinfo);
+ if (!proc_create_data("tcp6", 0444, net->proc_net,
+ &tcp6_afinfo_seq_fops, &tcp6_seq_afinfo))
+ return -ENOMEM;
+ return 0;
}
void tcp6_proc_exit(struct net *net)
{
- tcp_proc_unregister(net, &tcp6_seq_afinfo);
+ remove_proc_entry("tcp6", net->proc_net);
}
#endif