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

Function icmap_track_add

exec/icmap.c:1163–1206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1161}
1162
1163cs_error_t icmap_track_add(
1164 const char *key_name,
1165 int32_t track_type,
1166 icmap_notify_fn_t notify_fn,
1167 void *user_data,
1168 icmap_track_t *icmap_track)
1169{
1170 int32_t err;
1171
1172 if (notify_fn == NULL || icmap_track == NULL) {
1173 return (CS_ERR_INVALID_PARAM);
1174 }
1175
1176 if ((track_type & ~(ICMAP_TRACK_ADD | ICMAP_TRACK_DELETE | ICMAP_TRACK_MODIFY | ICMAP_TRACK_PREFIX)) != 0) {
1177 return (CS_ERR_INVALID_PARAM);
1178 }
1179
1180 *icmap_track = malloc(sizeof(**icmap_track));
1181 if (*icmap_track == NULL) {
1182 return (CS_ERR_NO_MEMORY);
1183 }
1184 memset(*icmap_track, 0, sizeof(**icmap_track));
1185
1186 if (key_name != NULL) {
1187 (*icmap_track)->key_name = strdup(key_name);
1188 };
1189
1190 (*icmap_track)->track_type = track_type;
1191 (*icmap_track)->notify_fn = notify_fn;
1192 (*icmap_track)->user_data = user_data;
1193
1194 if ((err = qb_map_notify_add(icmap_global_map->qb_map, (*icmap_track)->key_name, icmap_notify_fn,
1195 icmap_tt_to_qbtt(track_type), *icmap_track)) != 0) {
1196 free((*icmap_track)->key_name);
1197 free(*icmap_track);
1198
1199 return (qb_to_cs_error(err));
1200 }
1201
1202 qb_list_init(&(*icmap_track)->list);
1203 qb_list_add (&(*icmap_track)->list, &icmap_track_list_head);
1204
1205 return (CS_OK);
1206}
1207
1208cs_error_t icmap_track_delete(icmap_track_t icmap_track)
1209{

Callers 12

cmap_exec_init_fnFunction · 0.85
mon_instance_initFunction · 0.85
wd_resource_createFunction · 0.85
wd_scan_resourcesFunction · 0.85
pload_exec_init_fnFunction · 0.85

Calls 2

icmap_tt_to_qbttFunction · 0.85
qb_to_cs_errorFunction · 0.85

Tested by

no test coverage detected