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

Function cmap_iter_init

lib/cmap.c:823–876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

821}
822
823cs_error_t cmap_iter_init(
824 cmap_handle_t handle,
825 const char *prefix,
826 cmap_iter_handle_t *cmap_iter_handle)
827{
828 cs_error_t error;
829 struct iovec iov;
830 struct cmap_inst *cmap_inst;
831 struct req_lib_cmap_iter_init req_lib_cmap_iter_init;
832 struct res_lib_cmap_iter_init res_lib_cmap_iter_init;
833
834 if (cmap_iter_handle == NULL) {
835 return (CS_ERR_INVALID_PARAM);
836 }
837
838 error = hdb_error_to_cs(hdb_handle_get (&cmap_handle_t_db, handle, (void *)&cmap_inst));
839 if (error != CS_OK) {
840 return (error);
841 }
842
843 memset(&req_lib_cmap_iter_init, 0, sizeof(req_lib_cmap_iter_init));
844 req_lib_cmap_iter_init.header.size = sizeof(req_lib_cmap_iter_init);
845 req_lib_cmap_iter_init.header.id = MESSAGE_REQ_CMAP_ITER_INIT;
846
847 if (prefix) {
848 if (strlen(prefix) >= CS_MAX_NAME_LENGTH) {
849 return (CS_ERR_NAME_TOO_LONG);
850 }
851 memcpy(req_lib_cmap_iter_init.prefix.value, prefix, strlen(prefix));
852 req_lib_cmap_iter_init.prefix.length = strlen(prefix);
853 }
854
855 iov.iov_base = (char *)&req_lib_cmap_iter_init;
856 iov.iov_len = sizeof(req_lib_cmap_iter_init);
857
858 error = qb_to_cs_error(qb_ipcc_sendv_recv(
859 cmap_inst->c,
860 &iov,
861 1,
862 &res_lib_cmap_iter_init,
863 sizeof (struct res_lib_cmap_iter_init), CS_IPC_TIMEOUT_MS));
864
865 if (error == CS_OK) {
866 error = res_lib_cmap_iter_init.header.error;
867 }
868
869 if (error == CS_OK) {
870 *cmap_iter_handle = res_lib_cmap_iter_init.iter_handle;
871 }
872
873 (void)hdb_handle_put (&cmap_handle_t_db, handle);
874
875 return (error);
876}
877
878cs_error_t cmap_iter_next(
879 cmap_handle_t handle,

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
newMethod · 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