- 2.6.17 port work build breaks, but the patch set is relativly stable
[linux-flexiantxendom0-3.2.10.git] / net / tipc / name_table.c
index 3f4b23b..d129422 100644 (file)
@@ -46,7 +46,7 @@
 #include "cluster.h"
 #include "bcast.h"
 
-int tipc_nametbl_size = 1024;          /* must be a power of 2 */
+static int tipc_nametbl_size = 1024;           /* must be a power of 2 */
 
 /**
  * struct sub_seq - container for all published instances of a name sequence
@@ -104,7 +104,7 @@ static atomic_t rsv_publ_ok = ATOMIC_INIT(0);
 rwlock_t tipc_nametbl_lock = RW_LOCK_UNLOCKED;
 
 
-static inline int hash(int x)
+static int hash(int x)
 {
        return(x & (tipc_nametbl_size - 1));
 }
@@ -121,7 +121,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
                (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
        if (publ == NULL) {
                warn("Memory squeeze; failed to create publication\n");
-               return 0;
+               return NULL;
        }
 
        memset(publ, 0, sizeof(*publ));
@@ -142,7 +142,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
  * tipc_subseq_alloc - allocate a specified number of sub-sequence structures
  */
 
-struct sub_seq *tipc_subseq_alloc(u32 cnt)
+static struct sub_seq *tipc_subseq_alloc(u32 cnt)
 {
        u32 sz = cnt * sizeof(struct sub_seq);
        struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
@@ -158,7 +158,7 @@ struct sub_seq *tipc_subseq_alloc(u32 cnt)
  * Allocates a single sub-sequence structure and sets it to all 0's.
  */
 
-struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
+static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
 {
        struct name_seq *nseq = 
                (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
@@ -168,7 +168,7 @@ struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
                warn("Memory squeeze; failed to create name sequence\n");
                kfree(nseq);
                kfree(sseq);
-               return 0;
+               return NULL;
        }
 
        memset(nseq, 0, sizeof(*nseq));
@@ -190,8 +190,8 @@ struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
  * Very time-critical, so binary searches through sub-sequence array.
  */
 
-static inline struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, 
-                                                 u32 instance)
+static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
+                                          u32 instance)
 {
        struct sub_seq *sseqs = nseq->sseqs;
        int low = 0;
@@ -207,7 +207,7 @@ static inline struct sub_seq *nameseq_find_subseq(struct name_seq *nseq,
                else
                        return &sseqs[mid];
        }
-       return 0;
+       return NULL;
 }
 
 /**
@@ -243,9 +243,9 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance)
  * tipc_nameseq_insert_publ - 
  */
 
-struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
-                                       u32 type, u32 lower, u32 upper,
-                                       u32 scope, u32 node, u32 port, u32 key)
+static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
+                                                   u32 type, u32 lower, u32 upper,
+                                                   u32 scope, u32 node, u32 port, u32 key)
 {
        struct subscription *s;
        struct subscription *st;
@@ -263,7 +263,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
 
                if ((sseq->lower != lower) || (sseq->upper != upper)) {
                        warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper);
-                       return 0;
+                       return NULL;
                }
        } else {
                u32 inspos;
@@ -278,7 +278,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
                if ((inspos < nseq->first_free) &&
                    (upper >= nseq->sseqs[inspos].lower)) {
                        warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper);
-                       return 0;
+                       return NULL;
                }
 
                /* Ensure there is space for new sub-sequence */
@@ -294,7 +294,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
                                nseq->alloc *= 2;
                        } else {
                                warn("Memory squeeze; failed to create sub-sequence\n");
-                               return 0;
+                               return NULL;
                        }
                }
                dbg("Have %u sseqs for type %u\n", nseq->alloc, type);
@@ -319,7 +319,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
 
        publ = publ_create(type, lower, upper, scope, node, port, key);
        if (!publ)
-               return 0;
+               return NULL;
        dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n",
            publ, node, publ->node, publ->subscr.node);
 
@@ -369,8 +369,8 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq,
  * tipc_nameseq_remove_publ -
  */
 
-struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
-                                            u32 node, u32 ref, u32 key)
+static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
+                                                   u32 node, u32 ref, u32 key)
 {
        struct publication *publ;
        struct publication *prev;
@@ -394,7 +394,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
                            i, &nseq->sseqs[i], nseq->sseqs[i].lower,
                            nseq->sseqs[i].upper);
                }
-               return 0;
+               return NULL;
        }
        dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n",
            nseq, sseq, nseq->type, inst, key);
@@ -413,7 +413,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
                prev->zone_list_next = publ->zone_list_next;
                sseq->zone_list = publ->zone_list_next;
        } else {
-               sseq->zone_list = 0;
+               sseq->zone_list = NULL;
        }
 
        if (in_own_cluster(node)) {
@@ -431,7 +431,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
                        prev->cluster_list_next = publ->cluster_list_next;
                        sseq->cluster_list = publ->cluster_list_next;
                } else {
-                       sseq->cluster_list = 0;
+                       sseq->cluster_list = NULL;
                }
        }
 
@@ -450,7 +450,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst,
                        prev->node_list_next = publ->node_list_next;
                        sseq->node_list = publ->node_list_next;
                } else {
-                       sseq->node_list = 0;
+                       sseq->node_list = NULL;
                }
        }
        assert(!publ->node || (publ->node == node));
@@ -535,7 +535,7 @@ static struct name_seq *nametbl_find_seq(u32 type)
                }
        }
 
-       return 0;
+       return NULL;
 };
 
 struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
@@ -547,7 +547,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
        if (lower > upper) {
                warn("Failed to publish illegal <%u,%u,%u>\n",
                     type, lower, upper);
-               return 0;
+               return NULL;
        }
 
        dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node);
@@ -556,7 +556,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper,
                dbg("tipc_nametbl_insert_publ: created %x\n", seq);
        }
        if (!seq)
-               return 0;
+               return NULL;
 
        assert(seq->type == type);
        return tipc_nameseq_insert_publ(seq, type, lower, upper,
@@ -570,7 +570,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
        struct name_seq *seq = nametbl_find_seq(type);
 
        if (!seq)
-               return 0;
+               return NULL;
 
        dbg("Withdrawing <%u,%u> from %x\n", type, lower, node);
        publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key);
@@ -594,7 +594,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower,
 u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode)
 {
        struct sub_seq *sseq;
-       struct publication *publ = 0;
+       struct publication *publ = NULL;
        struct name_seq *seq;
        u32 ref;
 
@@ -740,12 +740,12 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper,
        if (table.local_publ_count >= tipc_max_publications) {
                warn("Failed publish: max %u local publication\n", 
                     tipc_max_publications);
-               return 0;
+               return NULL;
        }
        if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) {
                warn("Failed to publish reserved name <%u,%u,%u>\n",
                     type, lower, upper);
-               return 0;
+               return NULL;
        }
 
        write_lock_bh(&tipc_nametbl_lock);
@@ -983,6 +983,7 @@ static void nametbl_list(struct print_buf *buf, u32 depth_info,
        }
 }
 
+#if 0
 void tipc_nametbl_print(struct print_buf *buf, const char *str)
 {
        tipc_printf(buf, str);
@@ -990,6 +991,7 @@ void tipc_nametbl_print(struct print_buf *buf, const char *str)
        nametbl_list(buf, 0, 0, 0, 0);
        read_unlock_bh(&tipc_nametbl_lock);
 }
+#endif
 
 #define MAX_NAME_TBL_QUERY 32768
 
@@ -1023,10 +1025,12 @@ struct sk_buff *tipc_nametbl_get(const void *req_tlv_area, int req_tlv_space)
        return buf;
 }
 
+#if 0
 void tipc_nametbl_dump(void)
 {
        nametbl_list(TIPC_CONS, 0, 0, 0, 0);
 }
+#endif
 
 int tipc_nametbl_init(void)
 {