| 82 | */ |
| 83 | |
| 84 | cs_error_t |
| 85 | corosync_cfg_initialize ( |
| 86 | corosync_cfg_handle_t *cfg_handle, |
| 87 | const corosync_cfg_callbacks_t *cfg_callbacks) |
| 88 | { |
| 89 | struct cfg_inst *cfg_inst; |
| 90 | cs_error_t error = CS_OK; |
| 91 | |
| 92 | error = hdb_error_to_cs (hdb_handle_create (&cfg_hdb, sizeof (struct cfg_inst), cfg_handle)); |
| 93 | if (error != CS_OK) { |
| 94 | goto error_no_destroy; |
| 95 | } |
| 96 | |
| 97 | error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, *cfg_handle, (void *)&cfg_inst)); |
| 98 | if (error != CS_OK) { |
| 99 | goto error_destroy; |
| 100 | } |
| 101 | |
| 102 | cfg_inst->finalize = 0; |
| 103 | cfg_inst->c = qb_ipcc_connect ("cfg", IPC_REQUEST_SIZE); |
| 104 | if (cfg_inst->c == NULL) { |
| 105 | error = qb_to_cs_error(-errno); |
| 106 | goto error_put_destroy; |
| 107 | } |
| 108 | |
| 109 | if (cfg_callbacks) { |
| 110 | memcpy (&cfg_inst->callbacks, cfg_callbacks, sizeof (corosync_cfg_callbacks_t)); |
| 111 | } |
| 112 | |
| 113 | (void)hdb_handle_put (&cfg_hdb, *cfg_handle); |
| 114 | |
| 115 | return (CS_OK); |
| 116 | |
| 117 | error_put_destroy: |
| 118 | (void)hdb_handle_put (&cfg_hdb, *cfg_handle); |
| 119 | error_destroy: |
| 120 | (void)hdb_handle_destroy (&cfg_hdb, *cfg_handle); |
| 121 | error_no_destroy: |
| 122 | return (error); |
| 123 | } |
| 124 | |
| 125 | cs_error_t |
| 126 | corosync_cfg_fd_get ( |