Kurt Hackel | 0c83ed8 | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 1 | /* -*- mode: c; c-basic-offset: 8; -*- |
| 2 | * vim: noexpandtab sw=8 ts=8 sts=0: |
| 3 | * |
| 4 | * nodemanager.h |
| 5 | * |
| 6 | * Function prototypes |
| 7 | * |
| 8 | * Copyright (C) 2004 Oracle. All rights reserved. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (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 GNU |
| 18 | * General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public |
| 21 | * License along with this program; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 021110-1307, USA. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef O2CLUSTER_NODEMANAGER_H |
| 28 | #define O2CLUSTER_NODEMANAGER_H |
| 29 | |
| 30 | #include "ocfs2_nodemanager.h" |
| 31 | |
| 32 | /* This totally doesn't belong here. */ |
| 33 | #include <linux/configfs.h> |
| 34 | #include <linux/rbtree.h> |
| 35 | |
Eric W. Biederman | 0e03036 | 2007-02-14 00:33:57 -0800 | [diff] [blame] | 36 | #define FS_OCFS2_NM 1 |
Kurt Hackel | 0c83ed8 | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 37 | |
| 38 | const char *o2nm_get_hb_ctl_path(void); |
| 39 | |
| 40 | struct o2nm_node { |
| 41 | spinlock_t nd_lock; |
| 42 | struct config_item nd_item; |
| 43 | char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */ |
| 44 | __u8 nd_num; |
| 45 | /* only one address per node, as attributes, for now. */ |
| 46 | __be32 nd_ipv4_address; |
| 47 | __be16 nd_ipv4_port; |
| 48 | struct rb_node nd_ip_node; |
| 49 | /* there can be only one local node for now */ |
| 50 | int nd_local; |
| 51 | |
| 52 | unsigned long nd_set_attributes; |
| 53 | }; |
| 54 | |
Andrew Beekhof | 296b75e | 2006-12-04 14:04:53 +0100 | [diff] [blame] | 55 | struct o2nm_cluster { |
| 56 | struct config_group cl_group; |
| 57 | unsigned cl_has_local:1; |
| 58 | u8 cl_local_node; |
| 59 | rwlock_t cl_nodes_lock; |
| 60 | struct o2nm_node *cl_nodes[O2NM_MAX_NODES]; |
| 61 | struct rb_root cl_node_ip_tree; |
Jeff Mahoney | b5dd803 | 2006-12-04 14:04:54 +0100 | [diff] [blame] | 62 | unsigned int cl_idle_timeout_ms; |
| 63 | unsigned int cl_keepalive_delay_ms; |
| 64 | unsigned int cl_reconnect_delay_ms; |
Andrew Beekhof | 296b75e | 2006-12-04 14:04:53 +0100 | [diff] [blame] | 65 | |
| 66 | /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ |
| 67 | unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
| 68 | }; |
| 69 | |
| 70 | extern struct o2nm_cluster *o2nm_single_cluster; |
| 71 | |
Kurt Hackel | 0c83ed8 | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 72 | u8 o2nm_this_node(void); |
| 73 | |
| 74 | int o2nm_configured_node_map(unsigned long *map, unsigned bytes); |
| 75 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num); |
| 76 | struct o2nm_node *o2nm_get_node_by_ip(__be32 addr); |
| 77 | void o2nm_node_get(struct o2nm_node *node); |
| 78 | void o2nm_node_put(struct o2nm_node *node); |
| 79 | |
Joel Becker | 1482942 | 2007-06-14 21:40:49 -0700 | [diff] [blame] | 80 | int o2nm_depend_item(struct config_item *item); |
| 81 | void o2nm_undepend_item(struct config_item *item); |
Joel Becker | 16c6a4f | 2007-06-19 11:34:03 -0700 | [diff] [blame^] | 82 | int o2nm_depend_this_node(void); |
| 83 | void o2nm_undepend_this_node(void); |
Joel Becker | 1482942 | 2007-06-14 21:40:49 -0700 | [diff] [blame] | 84 | |
Kurt Hackel | 0c83ed8 | 2005-12-15 14:31:23 -0800 | [diff] [blame] | 85 | #endif /* O2CLUSTER_NODEMANAGER_H */ |