Commit 9427c4b3 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[TCP]: Move seq_ops from tcp_iter_state to tcp_seq_afinfo.

No need to create seq_operations for each instance of 'netstat'.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1abf4fb2
...@@ -1328,8 +1328,8 @@ struct tcp_seq_afinfo { ...@@ -1328,8 +1328,8 @@ struct tcp_seq_afinfo {
struct module *owner; struct module *owner;
char *name; char *name;
sa_family_t family; sa_family_t family;
int (*seq_show) (struct seq_file *m, void *v);
struct file_operations *seq_fops; struct file_operations *seq_fops;
struct seq_operations seq_ops;
}; };
struct tcp_iter_state { struct tcp_iter_state {
...@@ -1338,7 +1338,6 @@ struct tcp_iter_state { ...@@ -1338,7 +1338,6 @@ struct tcp_iter_state {
enum tcp_seq_states state; enum tcp_seq_states state;
struct sock *syn_wait_sk; struct sock *syn_wait_sk;
int bucket, sbucket, num, uid; int bucket, sbucket, num, uid;
struct seq_operations seq_ops;
}; };
extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
......
...@@ -2229,13 +2229,9 @@ static int tcp_seq_open(struct inode *inode, struct file *file) ...@@ -2229,13 +2229,9 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
goto out_kfree; goto out_kfree;
s->family = afinfo->family; s->family = afinfo->family;
s->seq_ops.start = tcp_seq_start;
s->seq_ops.next = tcp_seq_next;
s->seq_ops.show = afinfo->seq_show;
s->seq_ops.stop = tcp_seq_stop;
s->p.net = net; s->p.net = net;
rc = seq_open(file, &s->seq_ops); rc = seq_open(file, &afinfo->seq_ops);
if (rc) if (rc)
goto out_put_net; goto out_put_net;
seq = file->private_data; seq = file->private_data;
...@@ -2269,6 +2265,10 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) ...@@ -2269,6 +2265,10 @@ int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
afinfo->seq_fops->llseek = seq_lseek; afinfo->seq_fops->llseek = seq_lseek;
afinfo->seq_fops->release = tcp_seq_release; afinfo->seq_fops->release = tcp_seq_release;
afinfo->seq_ops.start = tcp_seq_start;
afinfo->seq_ops.next = tcp_seq_next;
afinfo->seq_ops.stop = tcp_seq_stop;
p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops); p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
if (p) if (p)
p->data = afinfo; p->data = afinfo;
...@@ -2414,8 +2414,10 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = { ...@@ -2414,8 +2414,10 @@ static struct tcp_seq_afinfo tcp4_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "tcp", .name = "tcp",
.family = AF_INET, .family = AF_INET,
.seq_show = tcp4_seq_show,
.seq_fops = &tcp4_seq_fops, .seq_fops = &tcp4_seq_fops,
.seq_ops = {
.show = tcp4_seq_show,
},
}; };
static int tcp4_proc_init_net(struct net *net) static int tcp4_proc_init_net(struct net *net)
......
...@@ -2125,8 +2125,10 @@ static struct tcp_seq_afinfo tcp6_seq_afinfo = { ...@@ -2125,8 +2125,10 @@ static struct tcp_seq_afinfo tcp6_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "tcp6", .name = "tcp6",
.family = AF_INET6, .family = AF_INET6,
.seq_show = tcp6_seq_show,
.seq_fops = &tcp6_seq_fops, .seq_fops = &tcp6_seq_fops,
.seq_ops = {
.show = tcp6_seq_show,
},
}; };
int tcp6_proc_init(struct net *net) int tcp6_proc_init(struct net *net)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment