[NET]: Convert init_timer into setup_timer
[deliverable/linux.git] / net / ipv4 / ipvs / ip_vs_lblcr.c
index 6225acac7a3baf322e96db668ff0b2d11483b9af..f50da6411378e521c6696b08995ae819f1274251 100644 (file)
@@ -48,8 +48,7 @@
 /* for sysctl */
 #include <linux/fs.h>
 #include <linux/sysctl.h>
-/* for proc_net_create/proc_net_remove */
-#include <linux/proc_fs.h>
+#include <net/net_namespace.h>
 
 #include <net/ip_vs.h>
 
@@ -303,7 +302,6 @@ struct ip_vs_lblcr_table {
 
 static ctl_table vs_vars_table[] = {
        {
-               .ctl_name       = NET_IPV4_VS_LBLCR_EXPIRE,
                .procname       = "lblcr_expiration",
                .data           = &sysctl_ip_vs_lblcr_expiration,
                .maxlen         = sizeof(int),
@@ -315,7 +313,6 @@ static ctl_table vs_vars_table[] = {
 
 static ctl_table vs_table[] = {
        {
-               .ctl_name       = NET_IPV4_VS,
                .procname       = "vs",
                .mode           = 0555,
                .child          = vs_vars_table
@@ -546,71 +543,6 @@ static void ip_vs_lblcr_check_expire(unsigned long data)
        mod_timer(&tbl->periodic_timer, jiffies+CHECK_EXPIRE_INTERVAL);
 }
 
-
-#ifdef CONFIG_IP_VS_LBLCR_DEBUG
-static struct ip_vs_lblcr_table *lblcr_table_list;
-
-/*
- *     /proc/net/ip_vs_lblcr to display the mappings of
- *                  destination IP address <==> its serverSet
- */
-static int
-ip_vs_lblcr_getinfo(char *buffer, char **start, off_t offset, int length)
-{
-       off_t pos=0, begin;
-       int len=0, size;
-       struct ip_vs_lblcr_table *tbl;
-       unsigned long now = jiffies;
-       int i;
-       struct ip_vs_lblcr_entry *en;
-
-       tbl = lblcr_table_list;
-
-       size = sprintf(buffer, "LastTime Dest IP address  Server set\n");
-       pos += size;
-       len += size;
-
-       for (i=0; i<IP_VS_LBLCR_TAB_SIZE; i++) {
-               read_lock_bh(&tbl->lock);
-               list_for_each_entry(en, &tbl->bucket[i], list) {
-                       char tbuf[16];
-                       struct ip_vs_dest_list *d;
-
-                       sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(en->addr));
-                       size = sprintf(buffer+len, "%8lu %-16s ",
-                                      now-en->lastuse, tbuf);
-
-                       read_lock(&en->set.lock);
-                       for (d=en->set.list; d!=NULL; d=d->next) {
-                               size += sprintf(buffer+len+size,
-                                               "%u.%u.%u.%u ",
-                                               NIPQUAD(d->dest->addr));
-                       }
-                       read_unlock(&en->set.lock);
-                       size += sprintf(buffer+len+size, "\n");
-                       len += size;
-                       pos += size;
-                       if (pos <= offset)
-                               len=0;
-                       if (pos >= offset+length) {
-                               read_unlock_bh(&tbl->lock);
-                               goto done;
-                       }
-               }
-               read_unlock_bh(&tbl->lock);
-       }
-
-  done:
-       begin = len - (pos - offset);
-       *start = buffer + begin;
-       len -= begin;
-       if(len>length)
-               len = length;
-       return len;
-}
-#endif
-
-
 static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
 {
        int i;
@@ -643,15 +575,11 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
        /*
         *    Hook periodic timer for garbage collection
         */
-       init_timer(&tbl->periodic_timer);
-       tbl->periodic_timer.data = (unsigned long)tbl;
-       tbl->periodic_timer.function = ip_vs_lblcr_check_expire;
+       setup_timer(&tbl->periodic_timer, ip_vs_lblcr_check_expire,
+                       (unsigned long)tbl);
        tbl->periodic_timer.expires = jiffies+CHECK_EXPIRE_INTERVAL;
        add_timer(&tbl->periodic_timer);
 
-#ifdef CONFIG_IP_VS_LBLCR_DEBUG
-       lblcr_table_list = tbl;
-#endif
        return 0;
 }
 
@@ -840,20 +768,19 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
 
 static int __init ip_vs_lblcr_init(void)
 {
+       int ret;
+
        INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
        sysctl_header = register_sysctl_table(lblcr_root_table);
-#ifdef CONFIG_IP_VS_LBLCR_DEBUG
-       proc_net_create("ip_vs_lblcr", 0, ip_vs_lblcr_getinfo);
-#endif
-       return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
+       ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
+       if (ret)
+               unregister_sysctl_table(sysctl_header);
+       return ret;
 }
 
 
 static void __exit ip_vs_lblcr_cleanup(void)
 {
-#ifdef CONFIG_IP_VS_LBLCR_DEBUG
-       proc_net_remove("ip_vs_lblcr");
-#endif
        unregister_sysctl_table(sysctl_header);
        unregister_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
 }
This page took 0.026046 seconds and 5 git commands to generate.