Merge branch 'for_paulus' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc
[cascardo/linux.git] / net / tipc / name_distr.c
index 3144827..a3bbc89 100644 (file)
@@ -1,9 +1,8 @@
 /*
  * net/tipc/name_distr.c: TIPC name distribution code
  * 
- * Copyright (c) 2003-2005, Ericsson Research Canada
+ * Copyright (c) 2000-2006, Ericsson AB
  * Copyright (c) 2005, Wind River Systems
- * Copyright (c) 2005-2006, Ericsson AB
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -115,10 +114,10 @@ static struct sk_buff *named_prepare_buf(u32 type, u32 size, u32 dest)
 }
 
 /**
- * named_publish - tell other nodes about a new publication by this node
+ * tipc_named_publish - tell other nodes about a new publication by this node
  */
 
-void named_publish(struct publication *publ)
+void tipc_named_publish(struct publication *publ)
 {
        struct sk_buff *buf;
        struct distr_item *item;
@@ -134,15 +133,15 @@ void named_publish(struct publication *publ)
 
        item = (struct distr_item *)msg_data(buf_msg(buf));
        publ_to_item(item, publ);
-       dbg("named_withdraw: broadcasting publish msg\n");
-       cluster_broadcast(buf);
+       dbg("tipc_named_withdraw: broadcasting publish msg\n");
+       tipc_cltr_broadcast(buf);
 }
 
 /**
- * named_withdraw - tell other nodes about a withdrawn publication by this node
+ * tipc_named_withdraw - tell other nodes about a withdrawn publication by this node
  */
 
-void named_withdraw(struct publication *publ)
+void tipc_named_withdraw(struct publication *publ)
 {
        struct sk_buff *buf;
        struct distr_item *item;
@@ -158,25 +157,25 @@ void named_withdraw(struct publication *publ)
 
        item = (struct distr_item *)msg_data(buf_msg(buf));
        publ_to_item(item, publ);
-       dbg("named_withdraw: broadcasting withdraw msg\n");
-       cluster_broadcast(buf);
+       dbg("tipc_named_withdraw: broadcasting withdraw msg\n");
+       tipc_cltr_broadcast(buf);
 }
 
 /**
- * named_node_up - tell specified node about all publications by this node
+ * tipc_named_node_up - tell specified node about all publications by this node
  */
 
-void named_node_up(unsigned long node)
+void tipc_named_node_up(unsigned long node)
 {
        struct publication *publ;
-       struct distr_item *item = 0;
-       struct sk_buff *buf = 0;
+       struct distr_item *item = NULL;
+       struct sk_buff *buf = NULL;
        u32 left = 0;
        u32 rest;
        u32 max_item_buf;
 
        assert(in_own_cluster(node));
-       read_lock_bh(&nametbl_lock); 
+       read_lock_bh(&tipc_nametbl_lock); 
        max_item_buf = TIPC_MAX_USER_MSG_SIZE / ITEM_SIZE;
        max_item_buf *= ITEM_SIZE;
        rest = publ_cnt * ITEM_SIZE;
@@ -197,15 +196,15 @@ void named_node_up(unsigned long node)
                left -= ITEM_SIZE;
                if (!left) {
                        msg_set_link_selector(buf_msg(buf), node);
-                       dbg("named_node_up: sending publish msg to "
+                       dbg("tipc_named_node_up: sending publish msg to "
                            "<%u.%u.%u>\n", tipc_zone(node), 
                            tipc_cluster(node), tipc_node(node));
-                       link_send(buf, node, node);
-                       buf = 0;
+                       tipc_link_send(buf, node, node);
+                       buf = NULL;
                }
        }
 exit:
-       read_unlock_bh(&nametbl_lock); 
+       read_unlock_bh(&tipc_nametbl_lock); 
 }
 
 /**
@@ -222,73 +221,72 @@ exit:
 static void node_is_down(struct publication *publ)
 {
        struct publication *p;
-        write_lock_bh(&nametbl_lock);
+        write_lock_bh(&tipc_nametbl_lock);
        dbg("node_is_down: withdrawing %u, %u, %u\n", 
            publ->type, publ->lower, publ->upper);
         publ->key += 1222345;
-       p = nametbl_remove_publ(publ->type, publ->lower, 
-                               publ->node, publ->ref, publ->key);
+       p = tipc_nametbl_remove_publ(publ->type, publ->lower, 
+                                    publ->node, publ->ref, publ->key);
         assert(p == publ);
-       write_unlock_bh(&nametbl_lock);
-       if (publ)
-               kfree(publ);
+       write_unlock_bh(&tipc_nametbl_lock);
+       kfree(publ);
 }
 
 /**
- * named_recv - process name table update message sent by another node
+ * tipc_named_recv - process name table update message sent by another node
  */
 
-void named_recv(struct sk_buff *buf)
+void tipc_named_recv(struct sk_buff *buf)
 {
        struct publication *publ;
        struct tipc_msg *msg = buf_msg(buf);
        struct distr_item *item = (struct distr_item *)msg_data(msg);
        u32 count = msg_data_sz(msg) / ITEM_SIZE;
 
-       write_lock_bh(&nametbl_lock); 
+       write_lock_bh(&tipc_nametbl_lock); 
        while (count--) {
                if (msg_type(msg) == PUBLICATION) {
-                       dbg("named_recv: got publication for %u, %u, %u\n", 
+                       dbg("tipc_named_recv: got publication for %u, %u, %u\n", 
                            ntohl(item->type), ntohl(item->lower),
                            ntohl(item->upper));
-                       publ = nametbl_insert_publ(ntohl(item->type), 
-                                                  ntohl(item->lower),
-                                                  ntohl(item->upper),
-                                                  TIPC_CLUSTER_SCOPE,
-                                                  msg_orignode(msg), 
-                                                  ntohl(item->ref),
-                                                  ntohl(item->key));
+                       publ = tipc_nametbl_insert_publ(ntohl(item->type), 
+                                                       ntohl(item->lower),
+                                                       ntohl(item->upper),
+                                                       TIPC_CLUSTER_SCOPE,
+                                                       msg_orignode(msg), 
+                                                       ntohl(item->ref),
+                                                       ntohl(item->key));
                        if (publ) {
-                               nodesub_subscribe(&publ->subscr, 
-                                                 msg_orignode(msg), 
-                                                 publ,
-                                                 (net_ev_handler)node_is_down);
+                               tipc_nodesub_subscribe(&publ->subscr, 
+                                                      msg_orignode(msg), 
+                                                      publ,
+                                                      (net_ev_handler)node_is_down);
                        }
                } else if (msg_type(msg) == WITHDRAWAL) {
-                       dbg("named_recv: got withdrawl for %u, %u, %u\n", 
+                       dbg("tipc_named_recv: got withdrawl for %u, %u, %u\n", 
                            ntohl(item->type), ntohl(item->lower),
                            ntohl(item->upper));
-                       publ = nametbl_remove_publ(ntohl(item->type),
-                                                  ntohl(item->lower),
-                                                  msg_orignode(msg),
-                                                  ntohl(item->ref),
-                                                  ntohl(item->key));
+                       publ = tipc_nametbl_remove_publ(ntohl(item->type),
+                                                       ntohl(item->lower),
+                                                       msg_orignode(msg),
+                                                       ntohl(item->ref),
+                                                       ntohl(item->key));
 
                        if (publ) {
-                               nodesub_unsubscribe(&publ->subscr);
+                               tipc_nodesub_unsubscribe(&publ->subscr);
                                kfree(publ);
                        }
                } else {
-                       warn("named_recv: unknown msg\n");
+                       warn("tipc_named_recv: unknown msg\n");
                }
                item++;
        }
-       write_unlock_bh(&nametbl_lock); 
+       write_unlock_bh(&tipc_nametbl_lock); 
        buf_discard(buf);
 }
 
 /**
- * named_reinit - re-initialize local publication list
+ * tipc_named_reinit - re-initialize local publication list
  * 
  * This routine is called whenever TIPC networking is (re)enabled.
  * All existing publications by this node that have "cluster" or "zone" scope
@@ -296,15 +294,15 @@ void named_recv(struct sk_buff *buf)
  * (If the node's address is unchanged, the update loop terminates immediately.)
  */
 
-void named_reinit(void)
+void tipc_named_reinit(void)
 {
        struct publication *publ;
 
-       write_lock_bh(&nametbl_lock); 
+       write_lock_bh(&tipc_nametbl_lock); 
        list_for_each_entry(publ, &publ_root, local_list) {
                if (publ->node == tipc_own_addr)
                        break;
                publ->node = tipc_own_addr;
        }
-       write_unlock_bh(&nametbl_lock); 
+       write_unlock_bh(&tipc_nametbl_lock); 
 }