Merge git://oss.sgi.com:8090/xfs/xfs-2.6
[linux-drm-fsl-dcu.git] / net / ipv4 / ipvs / ip_vs_lblc.c
index 561cda326fa8092cf2b27da87cac78d68cded80e..76fd1fb91878b8a2bdd7fb4fe994963440f9eb23 100644 (file)
  * me to write this module.
  */
 
+#include <linux/ip.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/skbuff.h>
+#include <linux/jiffies.h>
 
 /* for sysctl */
 #include <linux/fs.h>
@@ -85,7 +88,7 @@ static int sysctl_ip_vs_lblc_expiration = 24*60*60*HZ;
  */
 struct ip_vs_lblc_entry {
        struct list_head        list;
-       __u32                   addr;           /* destination IP address */
+       __be32                  addr;           /* destination IP address */
        struct ip_vs_dest       *dest;          /* real server (cache) */
        unsigned long           lastuse;        /* last used time */
 };
@@ -115,7 +118,7 @@ static ctl_table vs_vars_table[] = {
                .procname       = "lblc_expiration",
                .data           = &sysctl_ip_vs_lblc_expiration,
                .maxlen         = sizeof(int),
-               .mode           = 0644, 
+               .mode           = 0644,
                .proc_handler   = &proc_dointvec_jiffies,
        },
        { .ctl_name = 0 }
@@ -125,7 +128,7 @@ static ctl_table vs_table[] = {
        {
                .ctl_name       = NET_IPV4_VS,
                .procname       = "vs",
-               .mode           = 0555, 
+               .mode           = 0555,
                .child          = vs_vars_table
        },
        { .ctl_name = 0 }
@@ -134,7 +137,7 @@ static ctl_table vs_table[] = {
 static ctl_table ipvs_ipv4_table[] = {
        {
                .ctl_name       = NET_IPV4,
-               .procname       = "ipv4", 
+               .procname       = "ipv4",
                .mode           = 0555,
                .child          = vs_table
        },
@@ -144,8 +147,8 @@ static ctl_table ipvs_ipv4_table[] = {
 static ctl_table lblc_root_table[] = {
        {
                .ctl_name       = CTL_NET,
-               .procname       = "net", 
-               .mode           = 0555, 
+               .procname       = "net",
+               .mode           = 0555,
                .child          = ipvs_ipv4_table
        },
        { .ctl_name = 0 }
@@ -158,7 +161,7 @@ static struct ctl_table_header * sysctl_header;
  *      IP address to a server.
  */
 static inline struct ip_vs_lblc_entry *
-ip_vs_lblc_new(__u32 daddr, struct ip_vs_dest *dest)
+ip_vs_lblc_new(__be32 daddr, struct ip_vs_dest *dest)
 {
        struct ip_vs_lblc_entry *en;
 
@@ -193,7 +196,7 @@ static inline void ip_vs_lblc_free(struct ip_vs_lblc_entry *en)
 /*
  *     Returns hash value for IPVS LBLC entry
  */
-static inline unsigned ip_vs_lblc_hashkey(__u32 addr)
+static inline unsigned ip_vs_lblc_hashkey(__be32 addr)
 {
        return (ntohl(addr)*2654435761UL) & IP_VS_LBLC_TAB_MASK;
 }
@@ -228,38 +231,11 @@ ip_vs_lblc_hash(struct ip_vs_lblc_table *tbl, struct ip_vs_lblc_entry *en)
 }
 
 
-#if 0000
-/*
- *     Unhash ip_vs_lblc_entry from ip_vs_lblc_table.
- *     returns bool success.
- */
-static int ip_vs_lblc_unhash(struct ip_vs_lblc_table *tbl,
-                            struct ip_vs_lblc_entry *en)
-{
-       if (list_empty(&en->list)) {
-               IP_VS_ERR("ip_vs_lblc_unhash(): request for not hashed entry, "
-                         "called from %p\n", __builtin_return_address(0));
-               return 0;
-       }
-
-       /*
-        * Remove it from the table
-        */
-       write_lock(&tbl->lock);
-       list_del(&en->list);
-       INIT_LIST_HEAD(&en->list);
-       write_unlock(&tbl->lock);
-
-       return 1;
-}
-#endif
-
-
 /*
  *  Get ip_vs_lblc_entry associated with supplied parameters.
  */
 static inline struct ip_vs_lblc_entry *
-ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __u32 addr)
+ip_vs_lblc_get(struct ip_vs_lblc_table *tbl, __be32 addr)
 {
        unsigned hash;
        struct ip_vs_lblc_entry *en;
@@ -312,7 +288,7 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_lblc_table *tbl)
 
                write_lock(&tbl->lock);
                list_for_each_entry_safe(en, nxt, &tbl->bucket[j], list) {
-                       if (time_before(now, 
+                       if (time_before(now,
                                        en->lastuse + sysctl_ip_vs_lblc_expiration))
                                continue;