[UDP]: Move seq_ops from udp_iter_state to udp_seq_afinfo.
authorDenis V. Lunev <den@openvz.org>
Sat, 29 Mar 2008 01:24:26 +0000 (18:24 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 29 Mar 2008 01:24:26 +0000 (18:24 -0700)
No need to create seq_operations for each instance of 'netstat'.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/udp.h
net/ipv4/udp.c
net/ipv4/udplite.c
net/ipv6/udp.c
net/ipv6/udplite.c

index 77af7d46d8689789083f4eb485d77eb2de25316b..0079d17fd3a3e8d74a670312790213143d21b7aa 100644 (file)
@@ -189,8 +189,8 @@ struct udp_seq_afinfo {
        char                    *name;
        sa_family_t             family;
        struct hlist_head       *hashtable;
-       int                     (*seq_show) (struct seq_file *m, void *v);
        struct file_operations  *seq_fops;
+       struct seq_operations   seq_ops;
 };
 
 struct udp_iter_state {
@@ -198,7 +198,6 @@ struct udp_iter_state {
        sa_family_t             family;
        struct hlist_head       *hashtable;
        int                     bucket;
-       struct seq_operations   seq_ops;
 };
 
 #ifdef CONFIG_PROC_FS
index eb0c64da2634e162b74e53cbbb5832bf8e54c9dc..bae94b3eaa43925497e39bdb14ad74599266611f 100644 (file)
@@ -1591,13 +1591,9 @@ static int udp_seq_open(struct inode *inode, struct file *file)
 
        s->family               = afinfo->family;
        s->hashtable            = afinfo->hashtable;
-       s->seq_ops.start        = udp_seq_start;
-       s->seq_ops.next         = udp_seq_next;
-       s->seq_ops.show         = afinfo->seq_show;
-       s->seq_ops.stop         = udp_seq_stop;
        s->p.net                = net;
 
-       rc = seq_open(file, &s->seq_ops);
+       rc = seq_open(file, &afinfo->seq_ops);
        if (rc)
                goto out_put_net;
 
@@ -1634,6 +1630,10 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
        afinfo->seq_fops->llseek        = seq_lseek;
        afinfo->seq_fops->release       = udp_seq_release;
 
+       afinfo->seq_ops.start           = udp_seq_start;
+       afinfo->seq_ops.next            = udp_seq_next;
+       afinfo->seq_ops.stop            = udp_seq_stop;
+
        p = proc_net_fops_create(net, afinfo->name, S_IRUGO, afinfo->seq_fops);
        if (p)
                p->data = afinfo;
@@ -1690,8 +1690,10 @@ static struct udp_seq_afinfo udp4_seq_afinfo = {
        .name           = "udp",
        .family         = AF_INET,
        .hashtable      = udp_hash,
-       .seq_show       = udp4_seq_show,
        .seq_fops       = &udp4_seq_fops,
+       .seq_ops        = {
+               .show           = udp4_seq_show,
+       },
 };
 
 static int udp4_proc_init_net(struct net *net)
index 7c1e0271c0dbf7dc9ccd2936038f387f2122cac0..4add87553bcef3db8ac39e3fefde3986954065e7 100644 (file)
@@ -77,8 +77,10 @@ static struct udp_seq_afinfo udplite4_seq_afinfo = {
        .name           = "udplite",
        .family         = AF_INET,
        .hashtable      = udplite_hash,
-       .seq_show       = udp4_seq_show,
        .seq_fops       = &udplite4_seq_fops,
+       .seq_ops        = {
+               .show           = udp4_seq_show,
+       },
 };
 
 static int udplite4_proc_init_net(struct net *net)
index 463ae4d448a3dc3243b640a088a993bb0c272200..e35921a4668991d134ae0ed352d2fb16b8a5f1f8 100644 (file)
@@ -983,8 +983,10 @@ static struct udp_seq_afinfo udp6_seq_afinfo = {
        .name           = "udp6",
        .family         = AF_INET6,
        .hashtable      = udp_hash,
-       .seq_show       = udp6_seq_show,
        .seq_fops       = &udp6_seq_fops,
+       .seq_ops        = {
+               .show           = udp6_seq_show,
+       },
 };
 
 int udp6_proc_init(struct net *net)
index c5f5357d115d9621970e152679c42d07f28af544..710366c3f0a6e46f030e869a51b777898beab146 100644 (file)
@@ -102,8 +102,10 @@ static struct udp_seq_afinfo udplite6_seq_afinfo = {
        .name           = "udplite6",
        .family         = AF_INET6,
        .hashtable      = udplite_hash,
-       .seq_show       = udp6_seq_show,
        .seq_fops       = &udplite6_seq_fops,
+       .seq_ops        = {
+               .show           = udp6_seq_show,
+       },
 };
 
 static int udplite6_proc_init_net(struct net *net)