X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Ftipc%2Fname_table.c;h=3f4b23bd08f74032935aa384825fadc755242f86;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=d129422fc5c22ed23ad469f069fdf3de66d8da35;hpb=4544ac5ae436e5ca8ac99f4296c50a5b880e349e;p=linux-2.6.git diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index d129422fc..3f4b23bd0 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c @@ -46,7 +46,7 @@ #include "cluster.h" #include "bcast.h" -static int tipc_nametbl_size = 1024; /* must be a power of 2 */ +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 int hash(int x) +static inline 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 NULL; + return 0; } 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 */ -static struct sub_seq *tipc_subseq_alloc(u32 cnt) +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 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt) * Allocates a single sub-sequence structure and sets it to all 0's. */ -static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) +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 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea warn("Memory squeeze; failed to create name sequence\n"); kfree(nseq); kfree(sseq); - return NULL; + return 0; } memset(nseq, 0, sizeof(*nseq)); @@ -190,8 +190,8 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea * Very time-critical, so binary searches through sub-sequence array. */ -static struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, - u32 instance) +static inline 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 struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, else return &sseqs[mid]; } - return NULL; + return 0; } /** @@ -243,9 +243,9 @@ static u32 nameseq_locate_subseq(struct name_seq *nseq, u32 instance) * tipc_nameseq_insert_publ - */ -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 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 @@ static 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 NULL; + return 0; } } else { u32 inspos; @@ -278,7 +278,7 @@ static 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 NULL; + return 0; } /* Ensure there is space for new sub-sequence */ @@ -294,7 +294,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, nseq->alloc *= 2; } else { warn("Memory squeeze; failed to create sub-sequence\n"); - return NULL; + return 0; } } dbg("Have %u sseqs for type %u\n", nseq->alloc, type); @@ -319,7 +319,7 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, publ = publ_create(type, lower, upper, scope, node, port, key); if (!publ) - return NULL; + return 0; dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n", publ, node, publ->node, publ->subscr.node); @@ -369,8 +369,8 @@ static struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, * tipc_nameseq_remove_publ - */ -static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, - u32 node, u32 ref, u32 key) +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 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i i, &nseq->sseqs[i], nseq->sseqs[i].lower, nseq->sseqs[i].upper); } - return NULL; + return 0; } dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n", nseq, sseq, nseq->type, inst, key); @@ -413,7 +413,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i prev->zone_list_next = publ->zone_list_next; sseq->zone_list = publ->zone_list_next; } else { - sseq->zone_list = NULL; + sseq->zone_list = 0; } if (in_own_cluster(node)) { @@ -431,7 +431,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i prev->cluster_list_next = publ->cluster_list_next; sseq->cluster_list = publ->cluster_list_next; } else { - sseq->cluster_list = NULL; + sseq->cluster_list = 0; } } @@ -450,7 +450,7 @@ static struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 i prev->node_list_next = publ->node_list_next; sseq->node_list = publ->node_list_next; } else { - sseq->node_list = NULL; + sseq->node_list = 0; } } assert(!publ->node || (publ->node == node)); @@ -535,7 +535,7 @@ static struct name_seq *nametbl_find_seq(u32 type) } } - return NULL; + return 0; }; 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 NULL; + return 0; } 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 NULL; + return 0; 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 NULL; + return 0; 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 = NULL; + struct publication *publ = 0; 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 NULL; + return 0; } if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) { warn("Failed to publish reserved name <%u,%u,%u>\n", type, lower, upper); - return NULL; + return 0; } write_lock_bh(&tipc_nametbl_lock); @@ -983,7 +983,6 @@ 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); @@ -991,7 +990,6 @@ 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 @@ -1025,12 +1023,10 @@ 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) {