45#include <sys/socket.h>
62 qb_ipcc_connection_t *
c;
68static void votequorum_inst_free (
void *inst);
81 goto error_no_destroy;
93 goto error_put_destroy;
101 hdb_handle_put (&votequorum_handle_t_db, *handle);
106 hdb_handle_put (&votequorum_handle_t_db, *handle);
108 hdb_handle_destroy (&votequorum_handle_t_db, *handle);
113static void votequorum_inst_free (
void *inst)
116 qb_ipcc_disconnect(vq_inst->
c);
126 if (error !=
CS_OK) {
134 hdb_handle_put (&votequorum_handle_t_db, handle);
140 hdb_handle_destroy (&votequorum_handle_t_db, handle);
142 hdb_handle_put (&votequorum_handle_t_db, handle);
160 if (error !=
CS_OK) {
178 if (error !=
CS_OK) {
197 hdb_handle_put (&votequorum_handle_t_db, handle);
213 if (error !=
CS_OK) {
232 if (error !=
CS_OK) {
239 hdb_handle_put (&votequorum_handle_t_db, handle);
256 if (error !=
CS_OK) {
275 if (error !=
CS_OK) {
282 hdb_handle_put (&votequorum_handle_t_db, handle);
299 if (error !=
CS_OK) {
318 if (error !=
CS_OK) {
325 hdb_handle_put (&votequorum_handle_t_db, handle);
340 if (error !=
CS_OK) {
357 if (error !=
CS_OK) {
364 hdb_handle_put (&votequorum_handle_t_db, handle);
378 if (error !=
CS_OK) {
384 hdb_handle_put (&votequorum_handle_t_db, handle);
397 if (error !=
CS_OK) {
403 hdb_handle_put (&votequorum_handle_t_db, handle);
417 if (error !=
CS_OK) {
423 (void)hdb_handle_put (&votequorum_handle_t_db, handle);
437 struct qb_ipc_response_header *dispatch_data;
452 error =
hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle,
454 if (error !=
CS_OK) {
466 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
491 if (error !=
CS_OK) {
505 switch (dispatch_data->id) {
568 hdb_handle_put (&votequorum_handle_t_db, handle);
582 if ((strlen(name) == 0) ||
588 if (error !=
CS_OK) {
607 if (error !=
CS_OK) {
614 hdb_handle_put (&votequorum_handle_t_db, handle);
622 unsigned int cast_vote,
631 if ((strlen(name) == 0) ||
637 if (error !=
CS_OK) {
657 if (error !=
CS_OK) {
664 hdb_handle_put (&votequorum_handle_t_db, handle);
680 if ((strlen(name) == 0) ||
686 if (error !=
CS_OK) {
705 if (error !=
CS_OK) {
712 hdb_handle_put (&votequorum_handle_t_db, handle);
736 if (error !=
CS_OK) {
755 if (error !=
CS_OK) {
762 hdb_handle_put (&votequorum_handle_t_db, handle);
777 if ((strlen(name) == 0) ||
783 if (error !=
CS_OK) {
801 if (error !=
CS_OK) {
808 hdb_handle_put (&votequorum_handle_t_db, handle);
cs_dispatch_flags_t
The cs_dispatch_flags_t enum.
@ CS_DISPATCH_ONE_NONBLOCKING
cs_error_t qb_to_cs_error(int result)
qb_to_cs_error
cs_error_t
The cs_error_t enum.
#define CS_IPC_TIMEOUT_MS
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
uint64_t votequorum_handle_t
votequorum_handle_t
@ MESSAGE_RES_VOTEQUORUM_NODELIST_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_EXPECTEDVOTES_NOTIFICATION
@ MESSAGE_RES_VOTEQUORUM_QUORUM_NOTIFICATION
@ MESSAGE_REQ_VOTEQUORUM_TRACKSTART
@ MESSAGE_REQ_VOTEQUORUM_GETINFO
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UNREGISTER
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_REGISTER
@ MESSAGE_REQ_VOTEQUORUM_TRACKSTOP
@ MESSAGE_REQ_VOTEQUORUM_SETEXPECTED
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_UPDATE
@ MESSAGE_REQ_VOTEQUORUM_SETVOTES
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_MASTER_WINS
@ MESSAGE_REQ_VOTEQUORUM_QDEVICE_POLL
#define VOTEQUORUM_QDEVICE_MAX_NAME_LEN
cs_error_t hdb_error_to_cs(int res)
#define IPC_DISPATCH_SIZE
cs_error_t votequorum_qdevice_register(votequorum_handle_t handle, const char *name)
Register a quorum device.
cs_error_t votequorum_setvotes(votequorum_handle_t handle, unsigned int nodeid, unsigned int votes)
set votes for a node
cs_error_t votequorum_qdevice_master_wins(votequorum_handle_t handle, const char *name, unsigned int allow)
Allow qdevice to tell votequorum if master_wins can be enabled or not.
cs_error_t votequorum_qdevice_poll(votequorum_handle_t handle, const char *name, unsigned int cast_vote, votequorum_ring_id_t ring_id)
Poll a quorum device.
cs_error_t votequorum_context_get(votequorum_handle_t handle, void **context)
Save and retrieve private data/context.
cs_error_t votequorum_finalize(votequorum_handle_t handle)
Close the quorum handle.
cs_error_t votequorum_trackstop(votequorum_handle_t handle)
votequorum_trackstop
cs_error_t votequorum_qdevice_unregister(votequorum_handle_t handle, const char *name)
Unregister a quorum device.
cs_error_t votequorum_fd_get(votequorum_handle_t handle, int *fd)
Get a file descriptor on which to poll.
cs_error_t votequorum_context_set(votequorum_handle_t handle, void *context)
votequorum_context_set
cs_error_t votequorum_trackstart(votequorum_handle_t handle, uint64_t context, unsigned int flags)
Track node and quorum changes.
cs_error_t votequorum_qdevice_update(votequorum_handle_t handle, const char *oldname, const char *newname)
Update registered name of a quorum device.
cs_error_t votequorum_dispatch(votequorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
Dispatch messages and configuration changes.
DECLARE_HDB_DATABASE(votequorum_handle_t_db, votequorum_inst_free)
cs_error_t votequorum_getinfo(votequorum_handle_t handle, unsigned int nodeid, struct votequorum_info *info)
Get quorum information.
cs_error_t votequorum_setexpected(votequorum_handle_t handle, unsigned int expected_votes)
set expected_votes
cs_error_t votequorum_initialize(votequorum_handle_t *handle, votequorum_callbacks_t *callbacks)
Create a new quorum connection.
The req_lib_votequorum_general struct.
The req_lib_votequorum_getinfo struct.
The req_lib_votequorum_qdevice_master_wins struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_poll struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_register struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_unregister struct.
char name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_qdevice_update struct.
char newname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
char oldname[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
The req_lib_votequorum_setexpected struct.
unsigned int expected_votes
The req_lib_votequorum_setvotes struct.
The req_lib_votequorum_trackstart struct.
The res_lib_votequorum_expectedvotes_notification struct.
The res_lib_votequorum_getinfo struct.
unsigned int highest_expected
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int expected_votes
unsigned int qdevice_votes
The res_lib_votequorum_quorum_notification struct.
The res_lib_votequorum_status struct.
The votequorum_callbacks_t struct.
votequorum_nodelist_notification_fn_t votequorum_nodelist_notify_fn
votequorum_expectedvotes_notification_fn_t votequorum_expectedvotes_notify_fn
votequorum_quorum_notification_fn_t votequorum_quorum_notify_fn
The votequorum_info struct.
unsigned int qdevice_votes
unsigned int highest_expected
char qdevice_name[VOTEQUORUM_QDEVICE_MAX_NAME_LEN]
unsigned int node_expected_votes
votequorum_callbacks_t callbacks
The votequorum_node_t struct.
The votequorum_ring_id_t struct.
struct memb_ring_id ring_id