2 * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU General Public License v.2.
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * Abstraction layer for clvmd cluster communications
20 #ifndef _CLVMD_COMMS_H
21 #define _CLVMD_COMMS_H
26 void (*cluster_init_completed) (void);
28 int (*cluster_send_message) (const void *buf, int msglen,
31 int (*name_from_csid) (const char *csid, char *name);
32 int (*csid_from_name) (char *csid, const char *name);
33 int (*get_num_nodes) (void);
34 int (*cluster_fd_callback) (struct local_client *fd, char *buf, int len,
36 struct local_client **new_client);
37 int (*get_main_cluster_fd) (void); /* gets accept FD or cman cluster socket */
38 int (*cluster_do_node_callback) (struct local_client *client,
39 void (*callback) (struct local_client *,
42 int (*is_quorate) (void);
44 void (*get_our_csid) (char *csid);
45 void (*add_up_node) (const char *csid);
46 void (*reread_config) (void);
47 void (*cluster_closedown) (void);
49 int (*get_cluster_name)(char *buf, int buflen);
51 int (*sync_lock) (const char *resource, int mode,
52 int flags, int *lockid);
53 int (*sync_unlock) (const char *resource, int lockid);
58 # include "tcp-comms.h"
59 struct cluster_ops *init_gulm_cluster(void);
60 #define MAX_CSID_LEN GULM_MAX_CSID_LEN
61 #define MAX_CLUSTER_MEMBER_NAME_LEN GULM_MAX_CLUSTER_MEMBER_NAME_LEN
65 # include <netinet/in.h>
67 # define CMAN_MAX_CSID_LEN 4
69 # define MAX_CSID_LEN CMAN_MAX_CSID_LEN
71 # undef MAX_CLUSTER_MEMBER_NAME_LEN
72 # define MAX_CLUSTER_MEMBER_NAME_LEN CMAN_MAX_NODENAME_LEN
73 # define CMAN_MAX_CLUSTER_MESSAGE 1500
74 # define CLUSTER_PORT_CLVMD 11
75 struct cluster_ops *init_cman_cluster(void);
79 # include <openais/saAis.h>
80 # include <corosync/totem/totem.h>
81 # define OPENAIS_CSID_LEN (sizeof(int))
82 # define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
83 # define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
84 # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
85 # define MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
87 # ifndef CMAN_MAX_CLUSTER_MESSAGE
88 # define CMAN_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
91 # define MAX_CSID_LEN sizeof(int)
93 struct cluster_ops *init_openais_cluster(void);
97 # include <corosync/corotypes.h>
98 # define COROSYNC_CSID_LEN (sizeof(int))
99 # define COROSYNC_MAX_CLUSTER_MESSAGE 65535
100 # define COROSYNC_MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
101 # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
102 # define MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
104 # ifndef CMAN_MAX_CLUSTER_MESSAGE
105 # define CMAN_MAX_CLUSTER_MESSAGE 65535
107 # ifndef MAX_CSID_LEN
108 # define MAX_CSID_LEN sizeof(int)
110 struct cluster_ops *init_corosync_cluster(void);
113 #ifdef USE_SINGLENODE
114 # define SINGLENODE_CSID_LEN (sizeof(int))
115 # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
116 # define MAX_CLUSTER_MEMBER_NAME_LEN 64
118 # define SINGLENODE_MAX_CLUSTER_MESSAGE 65535
119 # ifndef MAX_CSID_LEN
120 # define MAX_CSID_LEN sizeof(int)
122 struct cluster_ops *init_singlenode_cluster(void);