| 247 | } |
| 248 | |
| 249 | cs_error_t cpg_finalize ( |
| 250 | cpg_handle_t handle) |
| 251 | { |
| 252 | struct cpg_inst *cpg_inst; |
| 253 | struct iovec iov; |
| 254 | struct req_lib_cpg_finalize req_lib_cpg_finalize; |
| 255 | struct res_lib_cpg_finalize res_lib_cpg_finalize; |
| 256 | cs_error_t error; |
| 257 | |
| 258 | error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst)); |
| 259 | if (error != CS_OK) { |
| 260 | return (error); |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | * Another thread has already started finalizing |
| 265 | */ |
| 266 | if (cpg_inst->finalize) { |
| 267 | hdb_handle_put (&cpg_handle_t_db, handle); |
| 268 | return (CS_ERR_BAD_HANDLE); |
| 269 | } |
| 270 | |
| 271 | cpg_inst->finalize = 1; |
| 272 | |
| 273 | /* |
| 274 | * Send service request |
| 275 | */ |
| 276 | req_lib_cpg_finalize.header.size = sizeof (struct req_lib_cpg_finalize); |
| 277 | req_lib_cpg_finalize.header.id = MESSAGE_REQ_CPG_FINALIZE; |
| 278 | |
| 279 | iov.iov_base = (void *)&req_lib_cpg_finalize; |
| 280 | iov.iov_len = sizeof (struct req_lib_cpg_finalize); |
| 281 | |
| 282 | error = coroipcc_msg_send_reply_receive (cpg_inst->c, |
| 283 | &iov, |
| 284 | 1, |
| 285 | &res_lib_cpg_finalize, |
| 286 | sizeof (struct res_lib_cpg_finalize)); |
| 287 | |
| 288 | cpg_inst_finalize (cpg_inst, handle); |
| 289 | hdb_handle_put (&cpg_handle_t_db, handle); |
| 290 | |
| 291 | return (error); |
| 292 | } |
| 293 | |
| 294 | cs_error_t cpg_fd_get ( |
| 295 | cpg_handle_t handle, |