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

Function cmap_iter_next

lib/cmap.c:878–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

876}
877
878cs_error_t cmap_iter_next(
879 cmap_handle_t handle,
880 cmap_iter_handle_t iter_handle,
881 char key_name[],
882 size_t *value_len,
883 cmap_value_types_t *type)
884{
885 cs_error_t error;
886 struct iovec iov;
887 struct cmap_inst *cmap_inst;
888 struct req_lib_cmap_iter_next req_lib_cmap_iter_next;
889 struct res_lib_cmap_iter_next res_lib_cmap_iter_next;
890
891 if (key_name == NULL) {
892 return (CS_ERR_INVALID_PARAM);
893 }
894
895 error = hdb_error_to_cs(hdb_handle_get (&cmap_handle_t_db, handle, (void *)&cmap_inst));
896 if (error != CS_OK) {
897 return (error);
898 }
899
900 memset(&req_lib_cmap_iter_next, 0, sizeof(req_lib_cmap_iter_next));
901 req_lib_cmap_iter_next.header.size = sizeof(req_lib_cmap_iter_next);
902 req_lib_cmap_iter_next.header.id = MESSAGE_REQ_CMAP_ITER_NEXT;
903 req_lib_cmap_iter_next.iter_handle = iter_handle;
904
905 iov.iov_base = (char *)&req_lib_cmap_iter_next;
906 iov.iov_len = sizeof(req_lib_cmap_iter_next);
907
908 error = qb_to_cs_error(qb_ipcc_sendv_recv(
909 cmap_inst->c,
910 &iov,
911 1,
912 &res_lib_cmap_iter_next,
913 sizeof (struct res_lib_cmap_iter_next), CS_IPC_TIMEOUT_MS));
914
915 if (error == CS_OK) {
916 error = res_lib_cmap_iter_next.header.error;
917 }
918
919 if (error == CS_OK) {
920 memcpy(key_name, (const char *)res_lib_cmap_iter_next.key_name.value,
921 res_lib_cmap_iter_next.key_name.length);
922 key_name[res_lib_cmap_iter_next.key_name.length] = '\0';
923
924 if (value_len != NULL) {
925 *value_len = res_lib_cmap_iter_next.value_len;
926 }
927
928 if (type != NULL) {
929 *type = res_lib_cmap_iter_next.type;
930 }
931 }
932
933 (void)hdb_handle_put (&cmap_handle_t_db, handle);
934
935 return (error);

Callers 8

node_name_by_nodelistFunction · 0.85
nodestatusget_doFunction · 0.85
track_link_updown_eventsFunction · 0.85
print_iterFunction · 0.85
delete_with_prefixFunction · 0.85
nextMethod · 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