4 * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
9 * This copyrighted material is made available to anyone wishing to use,
10 * modify, copy, or redistribute it subject to the terms and conditions
11 * of the GNU General Public License v.2.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * Abstraction layer for clvmd cluster communications
22 #ifndef _CLVMD_COMMS_H
23 #define _CLVMD_COMMS_H
28 void (*cluster_init_completed
) (void);
30 int (*cluster_send_message
) (const void *buf
, int msglen
,
33 int (*name_from_csid
) (const char *csid
, char *name
);
34 int (*csid_from_name
) (char *csid
, const char *name
);
35 int (*get_num_nodes
) (void);
36 int (*cluster_fd_callback
) (struct local_client
*fd
, char *buf
, int len
,
38 struct local_client
**new_client
);
39 int (*get_main_cluster_fd
) (void); /* gets accept FD or cman cluster socket */
40 int (*cluster_do_node_callback
) (struct local_client
*client
,
41 void (*callback
) (struct local_client
*,
44 int (*is_quorate
) (void);
46 void (*get_our_csid
) (char *csid
);
47 void (*add_up_node
) (const char *csid
);
48 void (*reread_config
) (void);
49 void (*cluster_closedown
) (void);
51 int (*get_cluster_name
)(char *buf
, int buflen
);
53 int (*sync_lock
) (const char *resource
, int mode
,
54 int flags
, int *lockid
);
55 int (*sync_unlock
) (const char *resource
, int lockid
);
60 # include "tcp-comms.h"
61 struct cluster_ops
*init_gulm_cluster(void);
62 #define MAX_CSID_LEN GULM_MAX_CSID_LEN
63 #define MAX_CLUSTER_MEMBER_NAME_LEN GULM_MAX_CLUSTER_MEMBER_NAME_LEN
67 # include <netinet/in.h>
69 # define CMAN_MAX_CSID_LEN 4
71 # define MAX_CSID_LEN CMAN_MAX_CSID_LEN
73 # undef MAX_CLUSTER_MEMBER_NAME_LEN
74 # define MAX_CLUSTER_MEMBER_NAME_LEN CMAN_MAX_NODENAME_LEN
75 # define CMAN_MAX_CLUSTER_MESSAGE 1500
76 # define CLUSTER_PORT_CLVMD 11
77 struct cluster_ops
*init_cman_cluster(void);
81 # include <openais/saAis.h>
82 # include <corosync/totem/totem.h>
83 # define OPENAIS_CSID_LEN (sizeof(int))
84 # define OPENAIS_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
85 # define OPENAIS_MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
86 # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
87 # define MAX_CLUSTER_MEMBER_NAME_LEN SA_MAX_NAME_LENGTH
89 # ifndef CMAN_MAX_CLUSTER_MESSAGE
90 # define CMAN_MAX_CLUSTER_MESSAGE MESSAGE_SIZE_MAX
93 # define MAX_CSID_LEN sizeof(int)
95 struct cluster_ops
*init_openais_cluster(void);
99 # include <corosync/corotypes.h>
100 # define COROSYNC_CSID_LEN (sizeof(int))
101 # define COROSYNC_MAX_CLUSTER_MESSAGE 65535
102 # define COROSYNC_MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
103 # ifndef MAX_CLUSTER_MEMBER_NAME_LEN
104 # define MAX_CLUSTER_MEMBER_NAME_LEN CS_MAX_NAME_LENGTH
106 # ifndef CMAN_MAX_CLUSTER_MESSAGE
107 # define CMAN_MAX_CLUSTER_MESSAGE 65535
109 # ifndef MAX_CSID_LEN
110 # define MAX_CSID_LEN sizeof(int)
112 struct cluster_ops
*init_corosync_cluster(void);