Commit 3ba9441b authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[UDP]: Place file operations directly into udp_seq_afinfo.

No need to have separate never-used variable.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a2be75c1
...@@ -189,7 +189,7 @@ struct udp_seq_afinfo { ...@@ -189,7 +189,7 @@ struct udp_seq_afinfo {
char *name; char *name;
sa_family_t family; sa_family_t family;
struct hlist_head *hashtable; struct hlist_head *hashtable;
struct file_operations *seq_fops; struct file_operations seq_fops;
struct seq_operations seq_ops; struct seq_operations seq_ops;
}; };
......
...@@ -1596,17 +1596,17 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) ...@@ -1596,17 +1596,17 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
struct proc_dir_entry *p; struct proc_dir_entry *p;
int rc = 0; int rc = 0;
afinfo->seq_fops->owner = afinfo->owner; afinfo->seq_fops.owner = afinfo->owner;
afinfo->seq_fops->open = udp_seq_open; afinfo->seq_fops.open = udp_seq_open;
afinfo->seq_fops->read = seq_read; afinfo->seq_fops.read = seq_read;
afinfo->seq_fops->llseek = seq_lseek; afinfo->seq_fops.llseek = seq_lseek;
afinfo->seq_fops->release = seq_release_net; afinfo->seq_fops.release = seq_release_net;
afinfo->seq_ops.start = udp_seq_start; afinfo->seq_ops.start = udp_seq_start;
afinfo->seq_ops.next = udp_seq_next; afinfo->seq_ops.next = udp_seq_next;
afinfo->seq_ops.stop = udp_seq_stop; afinfo->seq_ops.stop = udp_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;
else else
...@@ -1617,7 +1617,6 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) ...@@ -1617,7 +1617,6 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo) void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo)
{ {
proc_net_remove(net, afinfo->name); proc_net_remove(net, afinfo->name);
memset(afinfo->seq_fops, 0, sizeof(*afinfo->seq_fops));
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
...@@ -1656,13 +1655,11 @@ int udp4_seq_show(struct seq_file *seq, void *v) ...@@ -1656,13 +1655,11 @@ int udp4_seq_show(struct seq_file *seq, void *v)
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
static struct file_operations udp4_seq_fops;
static struct udp_seq_afinfo udp4_seq_afinfo = { static struct udp_seq_afinfo udp4_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "udp", .name = "udp",
.family = AF_INET, .family = AF_INET,
.hashtable = udp_hash, .hashtable = udp_hash,
.seq_fops = &udp4_seq_fops,
.seq_ops = { .seq_ops = {
.show = udp4_seq_show, .show = udp4_seq_show,
}, },
......
...@@ -71,13 +71,11 @@ static struct inet_protosw udplite4_protosw = { ...@@ -71,13 +71,11 @@ static struct inet_protosw udplite4_protosw = {
}; };
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct file_operations udplite4_seq_fops;
static struct udp_seq_afinfo udplite4_seq_afinfo = { static struct udp_seq_afinfo udplite4_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "udplite", .name = "udplite",
.family = AF_INET, .family = AF_INET,
.hashtable = udplite_hash, .hashtable = udplite_hash,
.seq_fops = &udplite4_seq_fops,
.seq_ops = { .seq_ops = {
.show = udp4_seq_show, .show = udp4_seq_show,
}, },
......
...@@ -977,13 +977,11 @@ int udp6_seq_show(struct seq_file *seq, void *v) ...@@ -977,13 +977,11 @@ int udp6_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
static struct file_operations udp6_seq_fops;
static struct udp_seq_afinfo udp6_seq_afinfo = { static struct udp_seq_afinfo udp6_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "udp6", .name = "udp6",
.family = AF_INET6, .family = AF_INET6,
.hashtable = udp_hash, .hashtable = udp_hash,
.seq_fops = &udp6_seq_fops,
.seq_ops = { .seq_ops = {
.show = udp6_seq_show, .show = udp6_seq_show,
}, },
......
...@@ -96,13 +96,11 @@ void udplitev6_exit(void) ...@@ -96,13 +96,11 @@ void udplitev6_exit(void)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static struct file_operations udplite6_seq_fops;
static struct udp_seq_afinfo udplite6_seq_afinfo = { static struct udp_seq_afinfo udplite6_seq_afinfo = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "udplite6", .name = "udplite6",
.family = AF_INET6, .family = AF_INET6,
.hashtable = udplite_hash, .hashtable = udplite_hash,
.seq_fops = &udplite6_seq_fops,
.seq_ops = { .seq_ops = {
.show = udp6_seq_show, .show = udp6_seq_show,
}, },
......
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