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

Function cmap_adjust_int

lib/cmap.c:763–809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761}
762
763static cs_error_t cmap_adjust_int(cmap_handle_t handle, const char *key_name, int32_t step)
764{
765 cs_error_t error;
766 struct iovec iov;
767 struct cmap_inst *cmap_inst;
768 struct req_lib_cmap_adjust_int req_lib_cmap_adjust_int;
769 struct res_lib_cmap_adjust_int res_lib_cmap_adjust_int;
770
771 if (key_name == NULL) {
772 return (CS_ERR_INVALID_PARAM);
773 }
774 if (strlen(key_name) >= CS_MAX_NAME_LENGTH) {
775 return (CS_ERR_NAME_TOO_LONG);
776 }
777
778 error = hdb_error_to_cs(hdb_handle_get (&cmap_handle_t_db, handle, (void *)&cmap_inst));
779 if (error != CS_OK) {
780 return (error);
781 }
782
783 memset(&req_lib_cmap_adjust_int, 0, sizeof(req_lib_cmap_adjust_int));
784 req_lib_cmap_adjust_int.header.size = sizeof(req_lib_cmap_adjust_int);
785 req_lib_cmap_adjust_int.header.id = MESSAGE_REQ_CMAP_ADJUST_INT;
786
787 memcpy(req_lib_cmap_adjust_int.key_name.value, key_name, strlen(key_name));
788 req_lib_cmap_adjust_int.key_name.length = strlen(key_name);
789
790 req_lib_cmap_adjust_int.step = step;
791
792 iov.iov_base = (char *)&req_lib_cmap_adjust_int;
793 iov.iov_len = sizeof(req_lib_cmap_adjust_int);
794
795 error = qb_to_cs_error(qb_ipcc_sendv_recv(
796 cmap_inst->c,
797 &iov,
798 1,
799 &res_lib_cmap_adjust_int,
800 sizeof (struct res_lib_cmap_adjust_int), CS_IPC_TIMEOUT_MS));
801
802 if (error == CS_OK) {
803 error = res_lib_cmap_adjust_int.header.error;
804 }
805
806 (void)hdb_handle_put (&cmap_handle_t_db, handle);
807
808 return (error);
809}
810
811cs_error_t cmap_inc(cmap_handle_t handle, const char *key_name)
812{

Callers 2

cmap_incFunction · 0.85
cmap_decFunction · 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