* Function implementations */
| 87 | * Function implementations |
| 88 | */ |
| 89 | cs_error_t cmap_initialize (cmap_handle_t *handle) |
| 90 | { |
| 91 | cs_error_t error; |
| 92 | struct cmap_inst *cmap_inst; |
| 93 | |
| 94 | error = hdb_error_to_cs(hdb_handle_create(&cmap_handle_t_db, sizeof(*cmap_inst), handle)); |
| 95 | if (error != CS_OK) { |
| 96 | goto error_no_destroy; |
| 97 | } |
| 98 | |
| 99 | error = hdb_error_to_cs(hdb_handle_get(&cmap_handle_t_db, *handle, (void *)&cmap_inst)); |
| 100 | if (error != CS_OK) { |
| 101 | goto error_destroy; |
| 102 | } |
| 103 | |
| 104 | error = CS_OK; |
| 105 | cmap_inst->finalize = 0; |
| 106 | cmap_inst->c = qb_ipcc_connect("cmap", IPC_REQUEST_SIZE); |
| 107 | if (cmap_inst->c == NULL) { |
| 108 | error = qb_to_cs_error(-errno); |
| 109 | goto error_put_destroy; |
| 110 | } |
| 111 | |
| 112 | (void)hdb_handle_put(&cmap_handle_t_db, *handle); |
| 113 | |
| 114 | return (CS_OK); |
| 115 | |
| 116 | error_put_destroy: |
| 117 | (void)hdb_handle_put(&cmap_handle_t_db, *handle); |
| 118 | error_destroy: |
| 119 | (void)hdb_handle_destroy(&cmap_handle_t_db, *handle); |
| 120 | error_no_destroy: |
| 121 | return (error); |
| 122 | } |
| 123 | |
| 124 | cs_error_t cmap_initialize_map (cmap_handle_t *handle, |
| 125 | cmap_map_t map) |