Lines Matching refs:node
46 struct o2nm_node *node = NULL; in o2nm_get_node_by_num() local
52 node = o2nm_single_cluster->cl_nodes[node_num]; in o2nm_get_node_by_num()
53 if (node) in o2nm_get_node_by_num()
54 config_item_get(&node->nd_item); in o2nm_get_node_by_num()
57 return node; in o2nm_get_node_by_num()
85 struct o2nm_node *node, *ret = NULL; in o2nm_node_ip_tree_lookup() local
91 node = rb_entry(parent, struct o2nm_node, nd_ip_node); in o2nm_node_ip_tree_lookup()
93 cmp = memcmp(&ip_needle, &node->nd_ipv4_address, in o2nm_node_ip_tree_lookup()
100 ret = node; in o2nm_node_ip_tree_lookup()
115 struct o2nm_node *node = NULL; in o2nm_get_node_by_ip() local
122 node = o2nm_node_ip_tree_lookup(cluster, addr, NULL, NULL); in o2nm_get_node_by_ip()
123 if (node) in o2nm_get_node_by_ip()
124 config_item_get(&node->nd_item); in o2nm_get_node_by_ip()
128 return node; in o2nm_get_node_by_ip()
132 void o2nm_node_put(struct o2nm_node *node) in o2nm_node_put() argument
134 config_item_put(&node->nd_item); in o2nm_node_put()
138 void o2nm_node_get(struct o2nm_node *node) in o2nm_node_get() argument
140 config_item_get(&node->nd_item); in o2nm_node_get()
172 struct o2nm_node *node = to_o2nm_node(item); in o2nm_node_release() local
173 kfree(node); in o2nm_node_release()
176 static ssize_t o2nm_node_num_read(struct o2nm_node *node, char *page) in o2nm_node_num_read() argument
178 return sprintf(page, "%d\n", node->nd_num); in o2nm_node_num_read()
181 static struct o2nm_cluster *to_o2nm_cluster_from_node(struct o2nm_node *node) in to_o2nm_cluster_from_node() argument
185 return to_o2nm_cluster(node->nd_item.ci_parent->ci_parent); in to_o2nm_cluster_from_node()
195 static ssize_t o2nm_node_num_write(struct o2nm_node *node, const char *page, in o2nm_node_num_write() argument
198 struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); in o2nm_node_num_write()
213 if (!test_bit(O2NM_NODE_ATTR_ADDRESS, &node->nd_set_attributes) || in o2nm_node_num_write()
214 !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes)) in o2nm_node_num_write()
221 cluster->cl_nodes[tmp] = node; in o2nm_node_num_write()
222 node->nd_num = tmp; in o2nm_node_num_write()
231 static ssize_t o2nm_node_ipv4_port_read(struct o2nm_node *node, char *page) in o2nm_node_ipv4_port_read() argument
233 return sprintf(page, "%u\n", ntohs(node->nd_ipv4_port)); in o2nm_node_ipv4_port_read()
236 static ssize_t o2nm_node_ipv4_port_write(struct o2nm_node *node, in o2nm_node_ipv4_port_write() argument
251 node->nd_ipv4_port = htons(tmp); in o2nm_node_ipv4_port_write()
256 static ssize_t o2nm_node_ipv4_address_read(struct o2nm_node *node, char *page) in o2nm_node_ipv4_address_read() argument
258 return sprintf(page, "%pI4\n", &node->nd_ipv4_address); in o2nm_node_ipv4_address_read()
261 static ssize_t o2nm_node_ipv4_address_write(struct o2nm_node *node, in o2nm_node_ipv4_address_write() argument
265 struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); in o2nm_node_ipv4_address_write()
287 rb_link_node(&node->nd_ip_node, parent, p); in o2nm_node_ipv4_address_write()
288 rb_insert_color(&node->nd_ip_node, &cluster->cl_node_ip_tree); in o2nm_node_ipv4_address_write()
294 memcpy(&node->nd_ipv4_address, &ipv4_addr, sizeof(ipv4_addr)); in o2nm_node_ipv4_address_write()
299 static ssize_t o2nm_node_local_read(struct o2nm_node *node, char *page) in o2nm_node_local_read() argument
301 return sprintf(page, "%d\n", node->nd_local); in o2nm_node_local_read()
304 static ssize_t o2nm_node_local_write(struct o2nm_node *node, const char *page, in o2nm_node_local_write() argument
307 struct o2nm_cluster *cluster = to_o2nm_cluster_from_node(node); in o2nm_node_local_write()
320 if (!test_bit(O2NM_NODE_ATTR_ADDRESS, &node->nd_set_attributes) || in o2nm_node_local_write()
321 !test_bit(O2NM_NODE_ATTR_NUM, &node->nd_set_attributes) || in o2nm_node_local_write()
322 !test_bit(O2NM_NODE_ATTR_PORT, &node->nd_set_attributes)) in o2nm_node_local_write()
328 cluster->cl_local_node != node->nd_num) in o2nm_node_local_write()
333 ret = o2net_start_listening(node); in o2nm_node_local_write()
339 cluster->cl_local_node == node->nd_num) { in o2nm_node_local_write()
340 o2net_stop_listening(node); in o2nm_node_local_write()
344 node->nd_local = tmp; in o2nm_node_local_write()
345 if (node->nd_local) { in o2nm_node_local_write()
347 cluster->cl_local_node = node->nd_num; in o2nm_node_local_write()
414 struct o2nm_node *node = to_o2nm_node(item); in o2nm_node_show() local
420 ret = o2nm_node_attr->show(node, page); in o2nm_node_show()
428 struct o2nm_node *node = to_o2nm_node(item); in o2nm_node_store() local
439 if (test_bit(attr_index, &node->nd_set_attributes)) in o2nm_node_store()
442 ret = o2nm_node_attr->store(node, page, count); in o2nm_node_store()
446 set_bit(attr_index, &node->nd_set_attributes); in o2nm_node_store()
701 struct o2nm_node *node = NULL; in o2nm_node_group_make_item() local
706 node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); in o2nm_node_group_make_item()
707 if (node == NULL) in o2nm_node_group_make_item()
710 strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ in o2nm_node_group_make_item()
711 config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); in o2nm_node_group_make_item()
712 spin_lock_init(&node->nd_lock); in o2nm_node_group_make_item()
716 return &node->nd_item; in o2nm_node_group_make_item()
722 struct o2nm_node *node = to_o2nm_node(item); in o2nm_node_group_drop_item() local
725 o2net_disconnect_node(node); in o2nm_node_group_drop_item()
728 (cluster->cl_local_node == node->nd_num)) { in o2nm_node_group_drop_item()
731 o2net_stop_listening(node); in o2nm_node_group_drop_item()
739 if (node->nd_ipv4_address) in o2nm_node_group_drop_item()
740 rb_erase(&node->nd_ip_node, &cluster->cl_node_ip_tree); in o2nm_node_group_drop_item()
743 if (cluster->cl_nodes[node->nd_num] == node) { in o2nm_node_group_drop_item()
744 cluster->cl_nodes[node->nd_num] = NULL; in o2nm_node_group_drop_item()
745 clear_bit(node->nd_num, cluster->cl_nodes_bitmap); in o2nm_node_group_drop_item()
750 config_item_name(&node->nd_item)); in o2nm_node_group_drop_item()