aboutsummaryrefslogtreecommitdiff
path: root/net/tipc/cluster.c
diff options
context:
space:
mode:
authorPer Liden <per.liden@ericsson.com>2006-01-18 00:38:21 +0100
committerPer Liden <per.liden@ericsson.com>2006-01-18 00:45:16 +0100
commit4323add67792ced172d0d93b8b2e6187023115f1 (patch)
tree13224010f6f18029fb710a1e0b48392aea90b486 /net/tipc/cluster.c
parent1e63e681e06d438fdc542d40924a4f155d461bbd (diff)
[TIPC] Avoid polluting the global namespace
This patch adds a tipc_ prefix to all externally visible symbols. Signed-off-by: Per Liden <per.liden@ericsson.com>
Diffstat (limited to 'net/tipc/cluster.c')
-rw-r--r--net/tipc/cluster.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index f0f7bac51d4..ab974ca1937 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -44,15 +44,15 @@
#include "msg.h"
#include "bearer.h"
-void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
- u32 lower, u32 upper);
-struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest);
+void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
+ u32 lower, u32 upper);
+struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest);
-struct node **local_nodes = 0;
-struct node_map cluster_bcast_nodes = {0,{0,}};
-u32 highest_allowed_slave = 0;
+struct node **tipc_local_nodes = 0;
+struct node_map tipc_cltr_bcast_nodes = {0,{0,}};
+u32 tipc_highest_allowed_slave = 0;
-struct cluster *cluster_create(u32 addr)
+struct cluster *tipc_cltr_create(u32 addr)
{
struct _zone *z_ptr;
struct cluster *c_ptr;
@@ -77,16 +77,16 @@ struct cluster *cluster_create(u32 addr)
}
memset(c_ptr->nodes, 0, alloc);
if (in_own_cluster(addr))
- local_nodes = c_ptr->nodes;
+ tipc_local_nodes = c_ptr->nodes;
c_ptr->highest_slave = LOWEST_SLAVE - 1;
c_ptr->highest_node = 0;
- z_ptr = zone_find(tipc_zone(addr));
+ z_ptr = tipc_zone_find(tipc_zone(addr));
if (z_ptr == NULL) {
- z_ptr = zone_create(addr);
+ z_ptr = tipc_zone_create(addr);
}
if (z_ptr != NULL) {
- zone_attach_cluster(z_ptr, c_ptr);
+ tipc_zone_attach_cluster(z_ptr, c_ptr);
c_ptr->owner = z_ptr;
}
else {
@@ -97,23 +97,23 @@ struct cluster *cluster_create(u32 addr)
return c_ptr;
}
-void cluster_delete(struct cluster *c_ptr)
+void tipc_cltr_delete(struct cluster *c_ptr)
{
u32 n_num;
if (!c_ptr)
return;
for (n_num = 1; n_num <= c_ptr->highest_node; n_num++) {
- node_delete(c_ptr->nodes[n_num]);
+ tipc_node_delete(c_ptr->nodes[n_num]);
}
for (n_num = LOWEST_SLAVE; n_num <= c_ptr->highest_slave; n_num++) {
- node_delete(c_ptr->nodes[n_num]);
+ tipc_node_delete(c_ptr->nodes[n_num]);
}
kfree(c_ptr->nodes);
kfree(c_ptr);
}
-u32 cluster_next_node(struct cluster *c_ptr, u32 addr)
+u32 tipc_cltr_next_node(struct cluster *c_ptr, u32 addr)
{
struct node *n_ptr;
u32 n_num = tipc_node(addr) + 1;
@@ -122,24 +122,24 @@ u32 cluster_next_node(struct cluster *c_ptr, u32 addr)
return addr;
for (; n_num <= c_ptr->highest_node; n_num++) {
n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && node_has_active_links(n_ptr))
+ if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr;
}
for (n_num = 1; n_num < tipc_node(addr); n_num++) {
n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && node_has_active_links(n_ptr))
+ if (n_ptr && tipc_node_has_active_links(n_ptr))
return n_ptr->addr;
}
return 0;
}
-void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr)
+void tipc_cltr_attach_node(struct cluster *c_ptr, struct node *n_ptr)
{
u32 n_num = tipc_node(n_ptr->addr);
u32 max_n_num = tipc_max_nodes;
if (in_own_cluster(n_ptr->addr))
- max_n_num = highest_allowed_slave;
+ max_n_num = tipc_highest_allowed_slave;
assert(n_num > 0);
assert(n_num <= max_n_num);
assert(c_ptr->nodes[n_num] == 0);
@@ -149,12 +149,12 @@ void cluster_attach_node(struct cluster *c_ptr, struct node *n_ptr)
}
/**
- * cluster_select_router - select router to a cluster
+ * tipc_cltr_select_router - select router to a cluster
*
* Uses deterministic and fair algorithm.
*/
-u32 cluster_select_router(struct cluster *c_ptr, u32 ref)
+u32 tipc_cltr_select_router(struct cluster *c_ptr, u32 ref)
{
u32 n_num;
u32 ulim = c_ptr->highest_node;
@@ -174,29 +174,29 @@ u32 cluster_select_router(struct cluster *c_ptr, u32 ref)
/* Lookup upwards with wrap-around */
do {
- if (node_is_up(c_ptr->nodes[n_num]))
+ if (tipc_node_is_up(c_ptr->nodes[n_num]))
break;
} while (++n_num <= ulim);
if (n_num > ulim) {
n_num = 1;
do {
- if (node_is_up(c_ptr->nodes[n_num]))
+ if (tipc_node_is_up(c_ptr->nodes[n_num]))
break;
} while (++n_num < tstart);
if (n_num == tstart)
return 0;
}
assert(n_num <= ulim);
- return node_select_router(c_ptr->nodes[n_num], ref);
+ return tipc_node_select_router(c_ptr->nodes[n_num], ref);
}
/**
- * cluster_select_node - select destination node within a remote cluster
+ * tipc_cltr_select_node - select destination node within a remote cluster
*
* Uses deterministic and fair algorithm.
*/
-struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
+struct node *tipc_cltr_select_node(struct cluster *c_ptr, u32 selector)
{
u32 n_num;
u32 mask = tipc_max_nodes;
@@ -215,11 +215,11 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
/* Lookup upwards with wrap-around */
for (n_num = start_entry; n_num <= c_ptr->highest_node; n_num++) {
- if (node_has_active_links(c_ptr->nodes[n_num]))
+ if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
return c_ptr->nodes[n_num];
}
for (n_num = 1; n_num < start_entry; n_num++) {
- if (node_has_active_links(c_ptr->nodes[n_num]))
+ if (tipc_node_has_active_links(c_ptr->nodes[n_num]))
return c_ptr->nodes[n_num];
}
return 0;
@@ -229,7 +229,7 @@ struct node *cluster_select_node(struct cluster *c_ptr, u32 selector)
* Routing table management: See description in node.c
*/
-struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest)
+struct sk_buff *tipc_cltr_prepare_routing_msg(u32 data_size, u32 dest)
{
u32 size = INT_H_SIZE + data_size;
struct sk_buff *buf = buf_acquire(size);
@@ -243,39 +243,39 @@ struct sk_buff *cluster_prepare_routing_msg(u32 data_size, u32 dest)
return buf;
}
-void cluster_bcast_new_route(struct cluster *c_ptr, u32 dest,
+void tipc_cltr_bcast_new_route(struct cluster *c_ptr, u32 dest,
u32 lower, u32 upper)
{
- struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr);
+ struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
struct tipc_msg *msg;
if (buf) {
msg = buf_msg(buf);
msg_set_remote_node(msg, dest);
msg_set_type(msg, ROUTE_ADDITION);
- cluster_multicast(c_ptr, buf, lower, upper);
+ tipc_cltr_multicast(c_ptr, buf, lower, upper);
} else {
warn("Memory squeeze: broadcast of new route failed\n");
}
}
-void cluster_bcast_lost_route(struct cluster *c_ptr, u32 dest,
- u32 lower, u32 upper)
+void tipc_cltr_bcast_lost_route(struct cluster *c_ptr, u32 dest,
+ u32 lower, u32 upper)
{
- struct sk_buff *buf = cluster_prepare_routing_msg(0, c_ptr->addr);
+ struct sk_buff *buf = tipc_cltr_prepare_routing_msg(0, c_ptr->addr);
struct tipc_msg *msg;
if (buf) {
msg = buf_msg(buf);
msg_set_remote_node(msg, dest);
msg_set_type(msg, ROUTE_REMOVAL);
- cluster_multicast(c_ptr, buf, lower, upper);
+ tipc_cltr_multicast(c_ptr, buf, lower, upper);
} else {
warn("Memory squeeze: broadcast of lost route failed\n");
}
}
-void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
+void tipc_cltr_send_slave_routes(struct cluster *c_ptr, u32 dest)
{
struct sk_buff *buf;
struct tipc_msg *msg;
@@ -288,21 +288,21 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
assert(in_own_cluster(c_ptr->addr));
if (highest <= LOWEST_SLAVE)
return;
- buf = cluster_prepare_routing_msg(highest - LOWEST_SLAVE + 1,
- c_ptr->addr);
+ buf = tipc_cltr_prepare_routing_msg(highest - LOWEST_SLAVE + 1,
+ c_ptr->addr);
if (buf) {
msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, SLAVE_ROUTING_TABLE);
for (n_num = LOWEST_SLAVE; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] &&
- node_has_active_links(c_ptr->nodes[n_num])) {
+ tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1;
msg_set_dataoctet(msg, n_num);
}
}
if (send)
- link_send(buf, dest, dest);
+ tipc_link_send(buf, dest, dest);
else
buf_discard(buf);
} else {
@@ -310,7 +310,7 @@ void cluster_send_slave_routes(struct cluster *c_ptr, u32 dest)
}
}
-void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
+void tipc_cltr_send_ext_routes(struct cluster *c_ptr, u32 dest)
{
struct sk_buff *buf;
struct tipc_msg *msg;
@@ -323,20 +323,20 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
assert(!is_slave(dest));
assert(in_own_cluster(dest));
highest = c_ptr->highest_node;
- buf = cluster_prepare_routing_msg(highest + 1, c_ptr->addr);
+ buf = tipc_cltr_prepare_routing_msg(highest + 1, c_ptr->addr);
if (buf) {
msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, EXT_ROUTING_TABLE);
for (n_num = 1; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] &&
- node_has_active_links(c_ptr->nodes[n_num])) {
+ tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1;
msg_set_dataoctet(msg, n_num);
}
}
if (send)
- link_send(buf, dest, dest);
+ tipc_link_send(buf, dest, dest);
else
buf_discard(buf);
} else {
@@ -344,7 +344,7 @@ void cluster_send_ext_routes(struct cluster *c_ptr, u32 dest)
}
}
-void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
+void tipc_cltr_send_local_routes(struct cluster *c_ptr, u32 dest)
{
struct sk_buff *buf;
struct tipc_msg *msg;
@@ -354,20 +354,20 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
assert(is_slave(dest));
assert(in_own_cluster(c_ptr->addr));
- buf = cluster_prepare_routing_msg(highest, c_ptr->addr);
+ buf = tipc_cltr_prepare_routing_msg(highest, c_ptr->addr);
if (buf) {
msg = buf_msg(buf);
msg_set_remote_node(msg, c_ptr->addr);
msg_set_type(msg, LOCAL_ROUTING_TABLE);
for (n_num = 1; n_num <= highest; n_num++) {
if (c_ptr->nodes[n_num] &&
- node_has_active_links(c_ptr->nodes[n_num])) {
+ tipc_node_has_active_links(c_ptr->nodes[n_num])) {
send = 1;
msg_set_dataoctet(msg, n_num);
}
}
if (send)
- link_send(buf, dest, dest);
+ tipc_link_send(buf, dest, dest);
else
buf_discard(buf);
} else {
@@ -375,7 +375,7 @@ void cluster_send_local_routes(struct cluster *c_ptr, u32 dest)
}
}
-void cluster_recv_routing_table(struct sk_buff *buf)
+void tipc_cltr_recv_routing_table(struct sk_buff *buf)
{
struct tipc_msg *msg = buf_msg(buf);
struct cluster *c_ptr;
@@ -388,9 +388,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 c_num;
u32 n_num;
- c_ptr = cluster_find(rem_node);
+ c_ptr = tipc_cltr_find(rem_node);
if (!c_ptr) {
- c_ptr = cluster_create(rem_node);
+ c_ptr = tipc_cltr_create(rem_node);
if (!c_ptr) {
buf_discard(buf);
return;
@@ -412,10 +412,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 addr = tipc_addr(z_num, c_num, n_num);
n_ptr = c_ptr->nodes[n_num];
if (!n_ptr) {
- n_ptr = node_create(addr);
+ n_ptr = tipc_node_create(addr);
}
if (n_ptr)
- node_add_router(n_ptr, router);
+ tipc_node_add_router(n_ptr, router);
}
}
break;
@@ -428,10 +428,10 @@ void cluster_recv_routing_table(struct sk_buff *buf)
u32 addr = tipc_addr(z_num, c_num, slave_num);
n_ptr = c_ptr->nodes[slave_num];
if (!n_ptr) {
- n_ptr = node_create(addr);
+ n_ptr = tipc_node_create(addr);
}
if (n_ptr)
- node_add_router(n_ptr, router);
+ tipc_node_add_router(n_ptr, router);
}
}
break;
@@ -445,9 +445,9 @@ void cluster_recv_routing_table(struct sk_buff *buf)
}
n_ptr = c_ptr->nodes[tipc_node(rem_node)];
if (!n_ptr)
- n_ptr = node_create(rem_node);
+ n_ptr = tipc_node_create(rem_node);
if (n_ptr)
- node_add_router(n_ptr, router);
+ tipc_node_add_router(n_ptr, router);
break;
case ROUTE_REMOVAL:
if (!is_slave(tipc_own_addr)) {
@@ -459,7 +459,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
}
n_ptr = c_ptr->nodes[tipc_node(rem_node)];
if (n_ptr)
- node_remove_router(n_ptr, router);
+ tipc_node_remove_router(n_ptr, router);
break;
default:
assert(!"Illegal routing manager message received\n");
@@ -467,7 +467,7 @@ void cluster_recv_routing_table(struct sk_buff *buf)
buf_discard(buf);
}
-void cluster_remove_as_router(struct cluster *c_ptr, u32 router)
+void tipc_cltr_remove_as_router(struct cluster *c_ptr, u32 router)
{
u32 start_entry;
u32 tstop;
@@ -486,17 +486,17 @@ void cluster_remove_as_router(struct cluster *c_ptr, u32 router)
for (n_num = start_entry; n_num <= tstop; n_num++) {
if (c_ptr->nodes[n_num]) {
- node_remove_router(c_ptr->nodes[n_num], router);
+ tipc_node_remove_router(c_ptr->nodes[n_num], router);
}
}
}
/**
- * cluster_multicast - multicast message to local nodes
+ * tipc_cltr_multicast - multicast message to local nodes
*/
-void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
- u32 lower, u32 upper)
+void tipc_cltr_multicast(struct cluster *c_ptr, struct sk_buff *buf,
+ u32 lower, u32 upper)
{
struct sk_buff *buf_copy;
struct node *n_ptr;
@@ -505,9 +505,9 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
assert(lower <= upper);
assert(((lower >= 1) && (lower <= tipc_max_nodes)) ||
- ((lower >= LOWEST_SLAVE) && (lower <= highest_allowed_slave)));
+ ((lower >= LOWEST_SLAVE) && (lower <= tipc_highest_allowed_slave)));
assert(((upper >= 1) && (upper <= tipc_max_nodes)) ||
- ((upper >= LOWEST_SLAVE) && (upper <= highest_allowed_slave)));
+ ((upper >= LOWEST_SLAVE) && (upper <= tipc_highest_allowed_slave)));
assert(in_own_cluster(c_ptr->addr));
tstop = is_slave(upper) ? c_ptr->highest_slave : c_ptr->highest_node;
@@ -515,22 +515,22 @@ void cluster_multicast(struct cluster *c_ptr, struct sk_buff *buf,
tstop = upper;
for (n_num = lower; n_num <= tstop; n_num++) {
n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && node_has_active_links(n_ptr)) {
+ if (n_ptr && tipc_node_has_active_links(n_ptr)) {
buf_copy = skb_copy(buf, GFP_ATOMIC);
if (buf_copy == NULL)
break;
msg_set_destnode(buf_msg(buf_copy), n_ptr->addr);
- link_send(buf_copy, n_ptr->addr, n_ptr->addr);
+ tipc_link_send(buf_copy, n_ptr->addr, n_ptr->addr);
}
}
buf_discard(buf);
}
/**
- * cluster_broadcast - broadcast message to all nodes within cluster
+ * tipc_cltr_broadcast - broadcast message to all nodes within cluster
*/
-void cluster_broadcast(struct sk_buff *buf)
+void tipc_cltr_broadcast(struct sk_buff *buf)
{
struct sk_buff *buf_copy;
struct cluster *c_ptr;
@@ -541,7 +541,7 @@ void cluster_broadcast(struct sk_buff *buf)
u32 node_type;
if (tipc_mode == TIPC_NET_MODE) {
- c_ptr = cluster_find(tipc_own_addr);
+ c_ptr = tipc_cltr_find(tipc_own_addr);
assert(in_own_cluster(c_ptr->addr)); /* For now */
/* Send to standard nodes, then repeat loop sending to slaves */
@@ -550,14 +550,14 @@ void cluster_broadcast(struct sk_buff *buf)
for (node_type = 1; node_type <= 2; node_type++) {
for (n_num = tstart; n_num <= tstop; n_num++) {
n_ptr = c_ptr->nodes[n_num];
- if (n_ptr && node_has_active_links(n_ptr)) {
+ if (n_ptr && tipc_node_has_active_links(n_ptr)) {
buf_copy = skb_copy(buf, GFP_ATOMIC);
if (buf_copy == NULL)
goto exit;
msg_set_destnode(buf_msg(buf_copy),
n_ptr->addr);
- link_send(buf_copy, n_ptr->addr,
- n_ptr->addr);
+ tipc_link_send(buf_copy, n_ptr->addr,
+ n_ptr->addr);
}
}
tstart = LOWEST_SLAVE;
@@ -568,9 +568,9 @@ exit:
buf_discard(buf);
}
-int cluster_init(void)
+int tipc_cltr_init(void)
{
- highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves;
- return cluster_create(tipc_own_addr) ? TIPC_OK : -ENOMEM;
+ tipc_highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves;
+ return tipc_cltr_create(tipc_own_addr) ? TIPC_OK : -ENOMEM;
}