aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-04-11 03:31:28 -0400
committerChristoph Hellwig <hch@lst.de>2018-05-16 01:23:35 -0400
commit37d849bb4294e22d5250264e82beaf4dd8a5403c (patch)
tree8f2f81ca47b41241f5372eda7b91ee7e70a193e0 /net/ipv6/tcp_ipv6.c
parenta3d2599b24462c762719a70bc4d2ec8e8cb52fcf (diff)
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 'net/ipv6/tcp_ipv6.c')
-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:
1909 return 0; 1909 return 0;
1910} 1910}
1911 1911
1912static const struct seq_operations tcp6_seq_ops = {
1913 .show = tcp6_seq_show,
1914 .start = tcp_seq_start,
1915 .next = tcp_seq_next,
1916 .stop = tcp_seq_stop,
1917};
1918
1919static int tcp6_seq_open(struct inode *inode, struct file *file)
1920{
1921 return seq_open_net(inode, file, &tcp6_seq_ops,
1922 sizeof(struct tcp_iter_state));
1923}
1924
1912static const struct file_operations tcp6_afinfo_seq_fops = { 1925static const struct file_operations tcp6_afinfo_seq_fops = {
1913 .open = tcp_seq_open, 1926 .open = tcp6_seq_open,
1914 .read = seq_read, 1927 .read = seq_read,
1915 .llseek = seq_lseek, 1928 .llseek = seq_lseek,
1916 .release = seq_release_net 1929 .release = seq_release_net
1917}; 1930};
1918 1931
1919static struct tcp_seq_afinfo tcp6_seq_afinfo = { 1932static struct tcp_seq_afinfo tcp6_seq_afinfo = {
1920 .name = "tcp6",
1921 .family = AF_INET6, 1933 .family = AF_INET6,
1922 .seq_fops = &tcp6_afinfo_seq_fops,
1923 .seq_ops = {
1924 .show = tcp6_seq_show,
1925 },
1926}; 1934};
1927 1935
1928int __net_init tcp6_proc_init(struct net *net) 1936int __net_init tcp6_proc_init(struct net *net)
1929{ 1937{
1930 return tcp_proc_register(net, &tcp6_seq_afinfo); 1938 if (!proc_create_data("tcp6", 0444, net->proc_net,
1939 &tcp6_afinfo_seq_fops, &tcp6_seq_afinfo))
1940 return -ENOMEM;
1941 return 0;
1931} 1942}
1932 1943
1933void tcp6_proc_exit(struct net *net) 1944void tcp6_proc_exit(struct net *net)
1934{ 1945{
1935 tcp_proc_unregister(net, &tcp6_seq_afinfo); 1946 remove_proc_entry("tcp6", net->proc_net);
1936} 1947}
1937#endif 1948#endif
1938 1949