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

Function cmap_delete

lib/cmap.c:507–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507cs_error_t cmap_delete(cmap_handle_t handle, const char *key_name)
508{
509 cs_error_t error;
510 struct iovec iov;
511 struct cmap_inst *cmap_inst;
512 struct req_lib_cmap_delete req_lib_cmap_delete;
513 struct res_lib_cmap_delete res_lib_cmap_delete;
514
515 if (key_name == NULL) {
516 return (CS_ERR_INVALID_PARAM);
517 }
518 if (strlen(key_name) >= CS_MAX_NAME_LENGTH) {
519 return (CS_ERR_NAME_TOO_LONG);
520 }
521
522 error = hdb_error_to_cs(hdb_handle_get (&cmap_handle_t_db, handle, (void *)&cmap_inst));
523 if (error != CS_OK) {
524 return (error);
525 }
526
527 memset(&req_lib_cmap_delete, 0, sizeof(req_lib_cmap_delete));
528 req_lib_cmap_delete.header.size = sizeof(req_lib_cmap_delete);
529 req_lib_cmap_delete.header.id = MESSAGE_REQ_CMAP_DELETE;
530
531 memcpy(req_lib_cmap_delete.key_name.value, key_name, strlen(key_name));
532 req_lib_cmap_delete.key_name.length = strlen(key_name);
533
534 iov.iov_base = (char *)&req_lib_cmap_delete;
535 iov.iov_len = sizeof(req_lib_cmap_delete);
536
537 error = qb_to_cs_error(qb_ipcc_sendv_recv(
538 cmap_inst->c,
539 &iov,
540 1,
541 &res_lib_cmap_delete,
542 sizeof (struct res_lib_cmap_delete), CS_IPC_TIMEOUT_MS));
543
544 if (error == CS_OK) {
545 error = res_lib_cmap_delete.header.error;
546 }
547
548 (void)hdb_handle_put (&cmap_handle_t_db, handle);
549
550 return (error);
551}
552
553cs_error_t cmap_get(
554 cmap_handle_t handle,

Callers 4

delete_with_prefixFunction · 0.85
read_in_config_fileFunction · 0.85
mainFunction · 0.85

Calls 4

hdb_error_to_csFunction · 0.85
hdb_handle_getFunction · 0.85
qb_to_cs_errorFunction · 0.85
hdb_handle_putFunction · 0.85

Tested by

no test coverage detected