43 #include <sys/types.h>
44 #include <sys/socket.h>
48 #include <qb/qbipcc.h>
59 qb_ipcc_connection_t *
c;
65 static void quorum_inst_free (
void *inst);
72 uint32_t *quorum_type)
77 struct qb_ipc_request_header req;
82 goto error_no_destroy;
95 goto error_put_destroy;
98 req.size =
sizeof (req);
101 iov.iov_base = (
char *)&req;
102 iov.iov_len =
sizeof (req);
111 if (error !=
CS_OK) {
112 goto error_put_destroy;
124 (void)hdb_handle_put (&quorum_handle_t_db, *handle);
129 (void)hdb_handle_put (&quorum_handle_t_db, *handle);
131 (void)hdb_handle_destroy (&quorum_handle_t_db, *handle);
136 static void quorum_inst_free (
void *inst)
149 if (error !=
CS_OK) {
157 (void)hdb_handle_put (&quorum_handle_t_db, handle);
163 (void)hdb_handle_destroy (&quorum_handle_t_db, handle);
165 (void)hdb_handle_put (&quorum_handle_t_db, handle);
177 struct qb_ipc_request_header req;
181 if (error !=
CS_OK) {
185 req.size =
sizeof (req);
188 iov.iov_base = (
char *)&req;
189 iov.iov_len =
sizeof (req);
198 if (error !=
CS_OK) {
207 (void)hdb_handle_put (&quorum_handle_t_db, handle);
220 if (error !=
CS_OK) {
226 (void)hdb_handle_put (&quorum_handle_t_db, handle);
240 if (error !=
CS_OK) {
246 (void)hdb_handle_put (&quorum_handle_t_db, handle);
259 if (error !=
CS_OK) {
265 (void)hdb_handle_put (&quorum_handle_t_db, handle);
279 struct qb_ipc_response_header res;
282 if (error !=
CS_OK) {
300 if (error !=
CS_OK) {
307 (void)hdb_handle_put (&quorum_handle_t_db, handle);
318 struct qb_ipc_request_header req;
319 struct qb_ipc_response_header res;
322 if (error !=
CS_OK) {
326 req.size =
sizeof (req);
329 iov.iov_base = (
char *)&req;
330 iov.iov_len =
sizeof (req);
339 if (error !=
CS_OK) {
346 (void)hdb_handle_put (&quorum_handle_t_db, handle);
360 struct qb_ipc_response_header *dispatch_data;
374 if (error !=
CS_OK) {
386 dispatch_data = (
struct qb_ipc_response_header *)dispatch_buf;
411 if (error !=
CS_OK) {
424 switch (dispatch_data->id) {
461 (void)hdb_handle_put (&quorum_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
uint64_t quorum_handle_t
quorum_handle_t
@ MESSAGE_RES_QUORUM_NOTIFICATION
@ MESSAGE_REQ_QUORUM_GETTYPE
@ MESSAGE_REQ_QUORUM_TRACKSTART
@ MESSAGE_REQ_QUORUM_TRACKSTOP
@ MESSAGE_REQ_QUORUM_GETQUORATE
cs_error_t quorum_context_get(quorum_handle_t handle, const void **context)
quorum_context_get
DECLARE_HDB_DATABASE(quorum_handle_t_db, quorum_inst_free)
cs_error_t quorum_trackstop(quorum_handle_t handle)
quorum_trackstop
cs_error_t quorum_initialize(quorum_handle_t *handle, quorum_callbacks_t *callbacks, uint32_t *quorum_type)
Create a new quorum connection.
cs_error_t quorum_fd_get(quorum_handle_t handle, int *fd)
Get a file descriptor on which to poll.
cs_error_t quorum_trackstart(quorum_handle_t handle, unsigned int flags)
Track node and quorum changes.
cs_error_t quorum_finalize(quorum_handle_t handle)
Close the quorum handle.
cs_error_t quorum_getquorate(quorum_handle_t handle, int *quorate)
Get quorum information.
cs_error_t quorum_context_set(quorum_handle_t handle, const void *context)
quorum_context_set
cs_error_t quorum_dispatch(quorum_handle_t handle, cs_dispatch_flags_t dispatch_types)
Dispatch messages and configuration changes.
cs_error_t hdb_error_to_cs(int res)
#define IPC_DISPATCH_SIZE
The quorum_callbacks_t struct.
quorum_notification_fn_t quorum_notify_fn
quorum_callbacks_t callbacks
The req_lib_quorum_trackstart struct.
The res_lib_quorum_getquorate struct.
The res_lib_quorum_gettype struct.
The res_lib_quorum_notification struct.