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

Function cpg_iteration_initialize

lib/cpg.c:1252–1343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1250}
1251
1252cs_error_t cpg_iteration_initialize(
1253 cpg_handle_t handle,
1254 cpg_iteration_type_t iteration_type,
1255 const struct cpg_name *group,
1256 cpg_iteration_handle_t *cpg_iteration_handle)
1257{
1258 cs_error_t error;
1259 struct iovec iov;
1260 struct cpg_inst *cpg_inst;
1261 struct cpg_iteration_instance_t *cpg_iteration_instance;
1262 struct req_lib_cpg_iterationinitialize req_lib_cpg_iterationinitialize;
1263 struct res_lib_cpg_iterationinitialize res_lib_cpg_iterationinitialize;
1264
1265 if (group && group->length > CPG_MAX_NAME_LENGTH) {
1266 return (CS_ERR_NAME_TOO_LONG);
1267 }
1268 if (cpg_iteration_handle == NULL) {
1269 return (CS_ERR_INVALID_PARAM);
1270 }
1271
1272 if ((iteration_type == CPG_ITERATION_ONE_GROUP && group == NULL) ||
1273 (iteration_type != CPG_ITERATION_ONE_GROUP && group != NULL)) {
1274 return (CS_ERR_INVALID_PARAM);
1275 }
1276
1277 if (iteration_type != CPG_ITERATION_NAME_ONLY && iteration_type != CPG_ITERATION_ONE_GROUP &&
1278 iteration_type != CPG_ITERATION_ALL) {
1279
1280 return (CS_ERR_INVALID_PARAM);
1281 }
1282
1283 error = hdb_error_to_cs (hdb_handle_get (&cpg_handle_t_db, handle, (void *)&cpg_inst));
1284 if (error != CS_OK) {
1285 return (error);
1286 }
1287
1288 error = hdb_error_to_cs (hdb_handle_create (&cpg_iteration_handle_t_db,
1289 sizeof (struct cpg_iteration_instance_t), cpg_iteration_handle));
1290 if (error != CS_OK) {
1291 goto error_put_cpg_db;
1292 }
1293
1294 error = hdb_error_to_cs (hdb_handle_get (&cpg_iteration_handle_t_db, *cpg_iteration_handle,
1295 (void *)&cpg_iteration_instance));
1296 if (error != CS_OK) {
1297 goto error_destroy;
1298 }
1299
1300 cpg_iteration_instance->conn = cpg_inst->c;
1301
1302 qb_list_init (&cpg_iteration_instance->list);
1303
1304 req_lib_cpg_iterationinitialize.header.size = sizeof (struct req_lib_cpg_iterationinitialize);
1305 req_lib_cpg_iterationinitialize.header.id = MESSAGE_REQ_CPG_ITERATIONINITIALIZE;
1306 req_lib_cpg_iterationinitialize.iteration_type = iteration_type;
1307 if (group) {
1308 marshall_to_mar_cpg_name_t (&req_lib_cpg_iterationinitialize.group_name, group);
1309 }

Callers 3

display_groupsFunction · 0.85
newMethod · 0.85

Calls 7

hdb_error_to_csFunction · 0.85
hdb_handle_getFunction · 0.85
hdb_handle_createFunction · 0.85
hdb_handle_putFunction · 0.85
hdb_handle_destroyFunction · 0.85

Tested by

no test coverage detected