1 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 * Copyright (C) 2004 Oracle. All rights reserved.
10 #ifndef O2CLUSTER_NODEMANAGER_H
11 #define O2CLUSTER_NODEMANAGER_H
13 #include "ocfs2_nodemanager.h"
15 /* This totally doesn't belong here. */
16 #include <linux/configfs.h>
17 #include <linux/rbtree.h>
19 enum o2nm_fence_method {
22 O2NM_FENCE_METHODS, /* Number of fence methods */
27 struct config_item nd_item;
28 char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */
30 /* only one address per node, as attributes, for now. */
31 __be32 nd_ipv4_address;
33 struct rb_node nd_ip_node;
34 /* there can be only one local node for now */
37 unsigned long nd_set_attributes;
41 struct config_group cl_group;
42 unsigned cl_has_local:1;
44 rwlock_t cl_nodes_lock;
45 struct o2nm_node *cl_nodes[O2NM_MAX_NODES];
46 struct rb_root cl_node_ip_tree;
47 unsigned int cl_idle_timeout_ms;
48 unsigned int cl_keepalive_delay_ms;
49 unsigned int cl_reconnect_delay_ms;
50 enum o2nm_fence_method cl_fence_method;
52 /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */
53 unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];
56 extern struct o2nm_cluster *o2nm_single_cluster;
58 u8 o2nm_this_node(void);
60 int o2nm_configured_node_map(unsigned long *map, unsigned bytes);
61 struct o2nm_node *o2nm_get_node_by_num(u8 node_num);
62 struct o2nm_node *o2nm_get_node_by_ip(__be32 addr);
63 void o2nm_node_get(struct o2nm_node *node);
64 void o2nm_node_put(struct o2nm_node *node);
66 int o2nm_depend_item(struct config_item *item);
67 void o2nm_undepend_item(struct config_item *item);
68 int o2nm_depend_this_node(void);
69 void o2nm_undepend_this_node(void);
71 #endif /* O2CLUSTER_NODEMANAGER_H */