MCPcopy Create free account
hub / github.com/corosync/corosync / votequorum_initialize

Function votequorum_initialize

lib/votequorum.c:72–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70DECLARE_HDB_DATABASE(votequorum_handle_t_db, votequorum_inst_free);
71
72cs_error_t votequorum_initialize (
73 votequorum_handle_t *handle,
74 votequorum_callbacks_t *callbacks)
75{
76 cs_error_t error;
77 struct votequorum_inst *votequorum_inst;
78
79 error = hdb_error_to_cs(hdb_handle_create (&votequorum_handle_t_db, sizeof (struct votequorum_inst), handle));
80 if (error != CS_OK) {
81 goto error_no_destroy;
82 }
83
84 error = hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, *handle, (void *)&votequorum_inst));
85 if (error != CS_OK) {
86 goto error_destroy;
87 }
88
89 votequorum_inst->finalize = 0;
90 votequorum_inst->c = qb_ipcc_connect ("votequorum", IPC_REQUEST_SIZE);
91 if (votequorum_inst->c == NULL) {
92 error = qb_to_cs_error(-errno);
93 goto error_put_destroy;
94 }
95
96 if (callbacks)
97 memcpy(&votequorum_inst->callbacks, callbacks, sizeof (*callbacks));
98 else
99 memset(&votequorum_inst->callbacks, 0, sizeof (*callbacks));
100
101 hdb_handle_put (&votequorum_handle_t_db, *handle);
102
103 return (CS_OK);
104
105error_put_destroy:
106 hdb_handle_put (&votequorum_handle_t_db, *handle);
107error_destroy:
108 hdb_handle_destroy (&votequorum_handle_t_db, *handle);
109error_no_destroy:
110 return (error);
111}
112
113static void votequorum_inst_free (void *inst)
114{

Callers 4

init_allFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
initializeFunction · 0.85

Calls 6

hdb_error_to_csFunction · 0.85
hdb_handle_createFunction · 0.85
hdb_handle_getFunction · 0.85
qb_to_cs_errorFunction · 0.85
hdb_handle_putFunction · 0.85
hdb_handle_destroyFunction · 0.85

Tested by 2

mainFunction · 0.68
mainFunction · 0.68