1 : /*
2 : * TIPC Linux kernel implementation
3 : * Copyright (c) 2001-2003 Ericsson Research Canada
4 : * Copyright (c) 2003 OSDL, Inc.
5 : *
6 : * This file is based on the original source code done by Jon Maloy
7 : * (jon.maloy@ericsson.com) for TIPC version 0.94, available from
8 : * http://tipc.sourceforge.net
9 : ***************************************************************************
10 : * This program is free software; you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License as published by
12 : * the Free Software Foundation; either version 2 of the License, or
13 : * (at your option) any later version.
14 : *
15 : * This program is distributed in the hope that it will be useful,
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : * GNU General Public License for more details.
19 : *
20 : * You should have received a copy of the GNU General Public License
21 : * along with this program; if not, write to the Free Software
22 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 : ***************************************************************************
24 : * Alphabetical list of people who have worked on this file:
25 : * - Mark Haverkamp (markh@osdl.org)
26 : * - Mika Kukkonen (mika@osdl.org)
27 : * - Rusty Lynch (rusty@linux.intel.com)
28 : */
29 :
30 : #include "local.h"
31 :
32 : #include "debug.h"
33 :
34 : struct tipc_local_network tipc_my_network;
35 : struct tipc_local_zone tipc_my_zone;
36 : struct tipc_local_cluster tipc_my_cluster;
37 : struct tipc_local_node tipc_my_node;
38 :
39 : static int __init
40 : local_node_init(uint my_node_id)
41 0 : {
42 0 : int status = 0;
43 :
44 : assert(my_node_id == 0);
45 0 : memset(&tipc_my_node, 0, sizeof (struct tipc_local_node));
46 0 : tipc_my_node.id = my_node_id;
47 0 : tipc_my_node.rep.addr = tipc_make_addr(tipc_my_zone.id, tipc_my_cluster.id, my_node_id);
48 : /* status = tipc_net_add_node(&tipc_my_node.rep); */
49 0 : return status;
50 : }
51 :
52 : static int __init
53 : local_cluster_init(uint my_cluster_id, uint my_node_id)
54 0 : {
55 0 : int status = 0;
56 :
57 : assert(my_cluster_id == 0);
58 0 : memset(&tipc_my_cluster, 0, sizeof (struct tipc_local_cluster));
59 0 : tipc_my_cluster.id = my_cluster_id;
60 0 : tipc_my_cluster.rep.addr = tipc_make_addr(tipc_my_zone.id, my_cluster_id, 0);
61 0 : tipc_my_cluster.nodes[0] = &tipc_my_node.rep;
62 0 : status = local_node_init(my_node_id);
63 : /* if (status == 0)
64 : status = tipc_net_add_cluster(&tipc_my_cluster.rep);
65 : */
66 : return status;
67 : }
68 :
69 : static int __init
70 : local_zone_init(uint my_zone_id, uint my_cluster_id, uint my_node_id)
71 0 : {
72 0 : int status = 0;
73 :
74 : assert(my_zone_id == 0);
75 0 : memset(&tipc_my_zone, 0, sizeof (struct tipc_local_zone));
76 0 : tipc_my_zone.id = my_zone_id;
77 0 : tipc_my_zone.rep.addr = tipc_make_addr(my_zone_id, 0, 0);
78 0 : tipc_my_zone.clusters[0] = &tipc_my_cluster.rep;
79 0 : status = local_cluster_init(my_cluster_id, my_node_id);
80 : /* if (status == 0)
81 : status = tipc_net_add_zone(&tipc_my_zone.rep);
82 : */
83 : return status;
84 : }
85 :
86 : int __init
87 : tipc_my_network_init(uint my_zone_id, uint my_cluster_id, uint my_node_id)
88 0 : {
89 0 : int status = 0;
90 :
91 0 : memset(&tipc_my_network, 0, sizeof (struct tipc_local_network));
92 0 : tipc_my_network.reg.object = (void*)&tipc_my_network;
93 0 : tipc_my_network.zones[0] = &tipc_my_zone.rep;
94 0 : status = local_zone_init(my_zone_id, my_cluster_id, my_node_id);
95 : return status;
96 : }
97 :
98 : void __exit
99 : tipc_my_network_exit(void)
100 0 : {
101 : /* uint i;
102 :
103 : for (i = 1; ((tipc_my_network.zone_count != 0) && (i < TIPC_ZONE_AMOUNT)); i++)
104 : if (tipc_my_network.zones[i])
105 : tipc_net_del_zone(i);
106 : */
107 : }
|