10c83ed8eSKurt Hackel /* -*- mode: c; c-basic-offset: 8; -*- 20c83ed8eSKurt Hackel * vim: noexpandtab sw=8 ts=8 sts=0: 30c83ed8eSKurt Hackel * 40c83ed8eSKurt Hackel * nodemanager.h 50c83ed8eSKurt Hackel * 60c83ed8eSKurt Hackel * Function prototypes 70c83ed8eSKurt Hackel * 80c83ed8eSKurt Hackel * Copyright (C) 2004 Oracle. All rights reserved. 90c83ed8eSKurt Hackel * 100c83ed8eSKurt Hackel * This program is free software; you can redistribute it and/or 110c83ed8eSKurt Hackel * modify it under the terms of the GNU General Public 120c83ed8eSKurt Hackel * License as published by the Free Software Foundation; either 130c83ed8eSKurt Hackel * version 2 of the License, or (at your option) any later version. 140c83ed8eSKurt Hackel * 150c83ed8eSKurt Hackel * This program is distributed in the hope that it will be useful, 160c83ed8eSKurt Hackel * but WITHOUT ANY WARRANTY; without even the implied warranty of 170c83ed8eSKurt Hackel * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 180c83ed8eSKurt Hackel * General Public License for more details. 190c83ed8eSKurt Hackel * 200c83ed8eSKurt Hackel * You should have received a copy of the GNU General Public 210c83ed8eSKurt Hackel * License along with this program; if not, write to the 220c83ed8eSKurt Hackel * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 230c83ed8eSKurt Hackel * Boston, MA 021110-1307, USA. 240c83ed8eSKurt Hackel * 250c83ed8eSKurt Hackel */ 260c83ed8eSKurt Hackel 270c83ed8eSKurt Hackel #ifndef O2CLUSTER_NODEMANAGER_H 280c83ed8eSKurt Hackel #define O2CLUSTER_NODEMANAGER_H 290c83ed8eSKurt Hackel 300c83ed8eSKurt Hackel #include "ocfs2_nodemanager.h" 310c83ed8eSKurt Hackel 320c83ed8eSKurt Hackel /* This totally doesn't belong here. */ 330c83ed8eSKurt Hackel #include <linux/configfs.h> 340c83ed8eSKurt Hackel #include <linux/rbtree.h> 350c83ed8eSKurt Hackel 360e03036cSEric W. Biederman #define FS_OCFS2_NM 1 370c83ed8eSKurt Hackel 380c83ed8eSKurt Hackel const char *o2nm_get_hb_ctl_path(void); 390c83ed8eSKurt Hackel 400c83ed8eSKurt Hackel struct o2nm_node { 410c83ed8eSKurt Hackel spinlock_t nd_lock; 420c83ed8eSKurt Hackel struct config_item nd_item; 430c83ed8eSKurt Hackel char nd_name[O2NM_MAX_NAME_LEN+1]; /* replace? */ 440c83ed8eSKurt Hackel __u8 nd_num; 450c83ed8eSKurt Hackel /* only one address per node, as attributes, for now. */ 460c83ed8eSKurt Hackel __be32 nd_ipv4_address; 470c83ed8eSKurt Hackel __be16 nd_ipv4_port; 480c83ed8eSKurt Hackel struct rb_node nd_ip_node; 490c83ed8eSKurt Hackel /* there can be only one local node for now */ 500c83ed8eSKurt Hackel int nd_local; 510c83ed8eSKurt Hackel 520c83ed8eSKurt Hackel unsigned long nd_set_attributes; 530c83ed8eSKurt Hackel }; 540c83ed8eSKurt Hackel 55296b75edSAndrew Beekhof struct o2nm_cluster { 56296b75edSAndrew Beekhof struct config_group cl_group; 57296b75edSAndrew Beekhof unsigned cl_has_local:1; 58296b75edSAndrew Beekhof u8 cl_local_node; 59296b75edSAndrew Beekhof rwlock_t cl_nodes_lock; 60296b75edSAndrew Beekhof struct o2nm_node *cl_nodes[O2NM_MAX_NODES]; 61296b75edSAndrew Beekhof struct rb_root cl_node_ip_tree; 62b5dd8030SJeff Mahoney unsigned int cl_idle_timeout_ms; 63b5dd8030SJeff Mahoney unsigned int cl_keepalive_delay_ms; 64b5dd8030SJeff Mahoney unsigned int cl_reconnect_delay_ms; 65296b75edSAndrew Beekhof 66296b75edSAndrew Beekhof /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ 67296b75edSAndrew Beekhof unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; 68296b75edSAndrew Beekhof }; 69296b75edSAndrew Beekhof 70296b75edSAndrew Beekhof extern struct o2nm_cluster *o2nm_single_cluster; 71296b75edSAndrew Beekhof 720c83ed8eSKurt Hackel u8 o2nm_this_node(void); 730c83ed8eSKurt Hackel 740c83ed8eSKurt Hackel int o2nm_configured_node_map(unsigned long *map, unsigned bytes); 750c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_num(u8 node_num); 760c83ed8eSKurt Hackel struct o2nm_node *o2nm_get_node_by_ip(__be32 addr); 770c83ed8eSKurt Hackel void o2nm_node_get(struct o2nm_node *node); 780c83ed8eSKurt Hackel void o2nm_node_put(struct o2nm_node *node); 790c83ed8eSKurt Hackel 80*14829422SJoel Becker int o2nm_depend_item(struct config_item *item); 81*14829422SJoel Becker void o2nm_undepend_item(struct config_item *item); 82*14829422SJoel Becker 830c83ed8eSKurt Hackel #endif /* O2CLUSTER_NODEMANAGER_H */ 84