| 171 | } |
| 172 | |
| 173 | cs_error_t cmap_finalize(cmap_handle_t handle) |
| 174 | { |
| 175 | struct cmap_inst *cmap_inst; |
| 176 | cs_error_t error; |
| 177 | hdb_handle_t track_inst_handle = 0; |
| 178 | struct cmap_track_inst *cmap_track_inst; |
| 179 | |
| 180 | error = hdb_error_to_cs(hdb_handle_get(&cmap_handle_t_db, handle, (void *)&cmap_inst)); |
| 181 | if (error != CS_OK) { |
| 182 | return (error); |
| 183 | } |
| 184 | |
| 185 | if (cmap_inst->finalize) { |
| 186 | (void)hdb_handle_put (&cmap_handle_t_db, handle); |
| 187 | return (CS_ERR_BAD_HANDLE); |
| 188 | } |
| 189 | cmap_inst->finalize = 1; |
| 190 | |
| 191 | /* |
| 192 | * Destroy all track instances for given connection |
| 193 | */ |
| 194 | hdb_iterator_reset(&cmap_track_handle_t_db); |
| 195 | while (hdb_iterator_next(&cmap_track_handle_t_db, |
| 196 | (void*)&cmap_track_inst, &track_inst_handle) == 0) { |
| 197 | |
| 198 | if (cmap_track_inst->c == cmap_inst->c) { |
| 199 | (void)hdb_handle_destroy(&cmap_track_handle_t_db, track_inst_handle); |
| 200 | } |
| 201 | |
| 202 | (void)hdb_handle_put (&cmap_track_handle_t_db, track_inst_handle); |
| 203 | } |
| 204 | |
| 205 | (void)hdb_handle_destroy(&cmap_handle_t_db, handle); |
| 206 | |
| 207 | (void)hdb_handle_put(&cmap_handle_t_db, handle); |
| 208 | |
| 209 | return (CS_OK); |
| 210 | } |
| 211 | |
| 212 | cs_error_t cmap_fd_get(cmap_handle_t handle, int *fd) |
| 213 | { |
no test coverage detected