[TIPC]: Removal of message header option code
[safe/jmp/linux-2.6] / net / tipc / zone.c
index 4eaef66..3506f85 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * net/tipc/zone.c: TIPC zone management routines
- * 
+ *
  * Copyright (c) 2000-2006, Ericsson AB
  * Copyright (c) 2005, Wind River Systems
  * All rights reserved.
 #include "cluster.h"
 #include "node.h"
 
-struct _zone *zone_create(u32 addr)
+struct _zone *tipc_zone_create(u32 addr)
 {
-       struct _zone *z_ptr = 0;
+       struct _zone *z_ptr;
        u32 z_num;
 
-       if (!addr_domain_valid(addr))
-               return 0;
+       if (!tipc_addr_domain_valid(addr)) {
+               err("Zone creation failed, invalid domain 0x%x\n", addr);
+               return NULL;
+       }
 
-       z_ptr = (struct _zone *)kmalloc(sizeof(*z_ptr), GFP_ATOMIC);
-       if (z_ptr != NULL) {
-               memset(z_ptr, 0, sizeof(*z_ptr));
-               z_num = tipc_zone(addr);
-               z_ptr->addr = tipc_addr(z_num, 0, 0);
-               net.zones[z_num] = z_ptr;
+       z_ptr = kzalloc(sizeof(*z_ptr), GFP_ATOMIC);
+       if (!z_ptr) {
+               warn("Zone creation failed, insufficient memory\n");
+               return NULL;
        }
+
+       z_num = tipc_zone(addr);
+       z_ptr->addr = tipc_addr(z_num, 0, 0);
+       tipc_net.zones[z_num] = z_ptr;
        return z_ptr;
 }
 
-void zone_delete(struct _zone *z_ptr)
+void tipc_zone_delete(struct _zone *z_ptr)
 {
        u32 c_num;
 
        if (!z_ptr)
                return;
        for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
-               cluster_delete(z_ptr->clusters[c_num]);
+               tipc_cltr_delete(z_ptr->clusters[c_num]);
        }
        kfree(z_ptr);
 }
 
-void zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
+void tipc_zone_attach_cluster(struct _zone *z_ptr, struct cluster *c_ptr)
 {
        u32 c_num = tipc_cluster(c_ptr->addr);
 
        assert(c_ptr->addr);
        assert(c_num <= tipc_max_clusters);
-       assert(z_ptr->clusters[c_num] == 0);
+       assert(z_ptr->clusters[c_num] == NULL);
        z_ptr->clusters[c_num] = c_ptr;
 }
 
-void zone_remove_as_router(struct _zone *z_ptr, u32 router)
+void tipc_zone_remove_as_router(struct _zone *z_ptr, u32 router)
 {
        u32 c_num;
 
        for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
                if (z_ptr->clusters[c_num]) {
-                       cluster_remove_as_router(z_ptr->clusters[c_num], 
-                                                router);
+                       tipc_cltr_remove_as_router(z_ptr->clusters[c_num],
+                                                  router);
                }
        }
 }
 
-void zone_send_external_routes(struct _zone *z_ptr, u32 dest)
+void tipc_zone_send_external_routes(struct _zone *z_ptr, u32 dest)
 {
        u32 c_num;
 
@@ -102,23 +106,23 @@ void zone_send_external_routes(struct _zone *z_ptr, u32 dest)
                if (z_ptr->clusters[c_num]) {
                        if (in_own_cluster(z_ptr->addr))
                                continue;
-                       cluster_send_ext_routes(z_ptr->clusters[c_num], dest);
+                       tipc_cltr_send_ext_routes(z_ptr->clusters[c_num], dest);
                }
        }
 }
 
-struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
+struct node *tipc_zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
 {
        struct cluster *c_ptr;
        struct node *n_ptr;
        u32 c_num;
 
        if (!z_ptr)
-               return 0;
+               return NULL;
        c_ptr = z_ptr->clusters[tipc_cluster(addr)];
        if (!c_ptr)
-               return 0;
-       n_ptr = cluster_select_node(c_ptr, ref);
+               return NULL;
+       n_ptr = tipc_cltr_select_node(c_ptr, ref);
        if (n_ptr)
                return n_ptr;
 
@@ -126,15 +130,15 @@ struct node *zone_select_remote_node(struct _zone *z_ptr, u32 addr, u32 ref)
        for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
                c_ptr = z_ptr->clusters[c_num];
                if (!c_ptr)
-                       return 0;
-               n_ptr = cluster_select_node(c_ptr, ref);
+                       return NULL;
+               n_ptr = tipc_cltr_select_node(c_ptr, ref);
                if (n_ptr)
                        return n_ptr;
        }
-       return 0;
+       return NULL;
 }
 
-u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
+u32 tipc_zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
 {
        struct cluster *c_ptr;
        u32 c_num;
@@ -143,14 +147,14 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
        if (!z_ptr)
                return 0;
        c_ptr = z_ptr->clusters[tipc_cluster(addr)];
-       router = c_ptr ? cluster_select_router(c_ptr, ref) : 0;
+       router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
        if (router)
                return router;
 
        /* Links to any other clusters within the zone? */
        for (c_num = 1; c_num <= tipc_max_clusters; c_num++) {
                c_ptr = z_ptr->clusters[c_num];
-               router = c_ptr ? cluster_select_router(c_ptr, ref) : 0;
+               router = c_ptr ? tipc_cltr_select_router(c_ptr, ref) : 0;
                if (router)
                        return router;
        }
@@ -158,12 +162,12 @@ u32 zone_select_router(struct _zone *z_ptr, u32 addr, u32 ref)
 }
 
 
-u32 zone_next_node(u32 addr)
+u32 tipc_zone_next_node(u32 addr)
 {
-       struct cluster *c_ptr = cluster_find(addr);
+       struct cluster *c_ptr = tipc_cltr_find(addr);
 
        if (c_ptr)
-               return cluster_next_node(c_ptr, addr);
+               return tipc_cltr_next_node(c_ptr, addr);
        return 0;
 }