40#include <sys/socket.h>
43#include <netinet/in.h>
60#define LOGSYS_UTILS_ONLY 1
101 const char **error_string,
135static int read_config_file_into_icmap(
136 const char **error_string,
icmap_map_t config_map);
137static char error_string_response[512];
139static int uid_determine (
const char *req_user)
142 struct passwd passwd;
143 struct passwd* pwdptr = &passwd;
144 struct passwd* temp_pwd_pt;
150 id = strtol(req_user, &ep, 10);
151 if (*req_user !=
'\0' && *ep ==
'\0' &&
id >= 0 &&
id <= UINT_MAX) {
155 pwdlinelen = sysconf (_SC_GETPW_R_SIZE_MAX);
157 if (pwdlinelen == -1) {
161 pwdbuffer = malloc (pwdlinelen);
163 while ((rc = getpwnam_r (req_user, pwdptr, pwdbuffer, pwdlinelen, &temp_pwd_pt)) == ERANGE) {
167 if (pwdlinelen <= 32678) {
168 n = realloc (pwdbuffer, pwdlinelen);
177 sprintf (error_string_response,
"getpwnam_r(): %s", strerror(rc));
180 if (temp_pwd_pt == NULL) {
182 sprintf (error_string_response,
183 "The '%s' user is not found in /etc/passwd, please read the documentation.",
187 pw_uid = passwd.pw_uid;
193static int gid_determine (
const char *req_group)
195 int corosync_gid = 0;
197 struct group * grpptr = &group;
198 struct group * temp_grp_pt;
204 id = strtol(req_group, &ep, 10);
205 if (*req_group !=
'\0' && *ep ==
'\0' &&
id >= 0 &&
id <= UINT_MAX) {
209 grplinelen = sysconf (_SC_GETGR_R_SIZE_MAX);
211 if (grplinelen == -1) {
215 grpbuffer = malloc (grplinelen);
217 while ((rc = getgrnam_r (req_group, grpptr, grpbuffer, grplinelen, &temp_grp_pt)) == ERANGE) {
221 if (grplinelen <= 32678) {
222 n = realloc (grpbuffer, grplinelen);
231 sprintf (error_string_response,
"getgrnam_r(): %s", strerror(rc));
234 if (temp_grp_pt == NULL) {
236 sprintf (error_string_response,
237 "The '%s' group is not found in /etc/group, please read the documentation.",
241 corosync_gid = group.gr_gid;
246static char *strchr_rs (
const char *haystack,
int byte)
248 const char *end_address = strchr (haystack,
byte);
252 while (*end_address ==
' ' || *end_address ==
'\t')
256 return ((
char *) end_address);
261 if (read_config_file_into_icmap(error_string, config_map)) {
268static char *remove_whitespace(
char *
string,
int remove_colon_and_brace)
274 while (*start ==
' ' || *start ==
'\t')
277 end = start+(strlen(start))-1;
278 while ((*end ==
' ' || *end ==
'\t' || (remove_colon_and_brace && (*end ==
':' || *end ==
'{'))) && end > start)
288static int parse_section(FILE *fp,
292 const char **error_string,
304 static char formated_err[384];
305 const char *tmp_error_string;
307 if (strcmp(path,
"") == 0) {
311 tmp_error_string = NULL;
313 while (fgets (line,
sizeof (line), fp)) {
316 if (strlen(line) > 0) {
321 if ((line[strlen(line) - 1] !=
'\n') && !feof(fp)) {
322 tmp_error_string =
"Line too long";
326 if (line[strlen(line) - 1] ==
'\n')
327 line[strlen(line) - 1] =
'\0';
328 if (strlen (line) > 0 && line[strlen(line) - 1] ==
'\r')
329 line[strlen(line) - 1] =
'\0';
334 for (i = strlen (line) - 1; i > -1; i--) {
335 if (line[i] ==
'\t' || line[i] ==
' ') {
343 for (i = 0; i < strlen (line); i++) {
344 if (line[i] !=
'\t' && line[i] !=
' ') {
359 if ((loc = strchr_rs (line,
'{'))) {
365 section = remove_whitespace(line, 1);
366 after_section = remove_whitespace(loc, 0);
368 if (strcmp(section,
"") == 0) {
369 tmp_error_string =
"Missing section name before opening bracket '{'";
373 if (strcmp(after_section,
"") != 0) {
374 tmp_error_string =
"Extra characters after opening bracket '{'";
379 tmp_error_string =
"Start of section makes total cmap path too long";
382 strcpy(new_keyname, path);
383 if (strcmp(path,
"") != 0) {
384 strcat(new_keyname,
".");
386 strcat(new_keyname, section);
391 &tmp_error_string, config_map,
user_data)) {
395 if (parse_section(fp, fname, line_no, new_keyname, error_string, depth + 1, newstate,
403 if ((loc = strchr_rs (line,
':'))) {
408 key = remove_whitespace(line, 1);
409 value = remove_whitespace(loc, 0);
412 tmp_error_string =
"New key makes total cmap path too long";
415 strcpy(new_keyname, path);
416 if (strcmp(path,
"") != 0) {
417 strcat(new_keyname,
".");
419 strcat(new_keyname, key);
429 if (strchr_rs (line,
'}')) {
431 trimmed_line = remove_whitespace(line, 0);
433 if (strcmp(trimmed_line,
"}") != 0) {
434 tmp_error_string =
"Extra characters before or after closing bracket '}'";
439 tmp_error_string =
"Unexpected closing brace";
455 tmp_error_string =
"Line is not opening or closing section or key value";
459 if (strcmp(path,
"") != 0) {
460 tmp_error_string =
"Missing closing brace";
464 if (strcmp(path,
"") == 0) {
471 if (snprintf(formated_err,
sizeof(formated_err),
"parser error: %s:%u: %s", fname, *line_no,
472 tmp_error_string) >=
sizeof(formated_err)) {
473 *error_string =
"Can't format parser error message";
475 *error_string = formated_err;
481static int safe_atoq_range(
icmap_value_types_t value_type,
long long int *min_val,
long long int *max_val)
483 switch (value_type) {
505 long long int min_val, max_val;
510 val = strtoll(str, &endptr, 10);
511 if (errno == ERANGE) {
519 if (*endptr !=
'\0') {
523 if (safe_atoq_range(target_type, &min_val, &max_val) != 0) {
527 if (val < min_val || val > max_val) {
535static int str_to_ull(
const char *str,
unsigned long long int *res)
537 unsigned long long int val;
542 val = strtoull(str, &endptr, 10);
543 if (errno == ERANGE) {
551 if (*endptr !=
'\0') {
559static int handle_crypto_model(
const char *val,
const char **error_string)
563 "Invalid crypto model. Should be ", error_string) == 1) {
570static int handle_compress_model(
const char *val,
const char **error_string)
574 "Invalid compression model. Should be ", error_string) == 1) {
581static int main_config_parser_cb(
const char *path,
586 const char **error_string,
592 long long int min_val, max_val;
594 unsigned long long int ull;
597 static char formated_err[256];
600 struct qb_list_head *iter, *tmp_iter;
609 if (strlen(path) >=
sizeof(key_name)) {
610 if (snprintf(formated_err,
sizeof(formated_err),
611 "Can't store path \"%s\" into key_name", path) >=
sizeof(formated_err)) {
612 *error_string =
"Can't format path into key_name error message";
614 *error_string = formated_err;
622 strncpy(key_name, path,
sizeof(key_name) - 1);
638 if ((strcmp(path,
"pload.count") == 0) ||
639 (strcmp(path,
"pload.size") == 0)) {
641 if (safe_atoq(
value, &val, val_type) != 0) {
645 goto icmap_set_error;
651 if ((strcmp(path,
"quorum.expected_votes") == 0) ||
652 (strcmp(path,
"quorum.votes") == 0) ||
653 (strcmp(path,
"quorum.last_man_standing_window") == 0) ||
654 (strcmp(path,
"quorum.leaving_timeout") == 0)) {
656 if (safe_atoq(
value, &val, val_type) != 0) {
660 goto icmap_set_error;
665 if ((strcmp(path,
"quorum.two_node") == 0) ||
666 (strcmp(path,
"quorum.expected_votes_tracking") == 0) ||
667 (strcmp(path,
"quorum.allow_downscale") == 0) ||
668 (strcmp(path,
"quorum.wait_for_all") == 0) ||
669 (strcmp(path,
"quorum.auto_tie_breaker") == 0) ||
670 (strcmp(path,
"quorum.last_man_standing") == 0)) {
672 if (safe_atoq(
value, &val, val_type) != 0) {
676 goto icmap_set_error;
682 if ((strcmp(path,
"quorum.device.timeout") == 0) ||
683 (strcmp(path,
"quorum.device.sync_timeout") == 0) ||
684 (strcmp(path,
"quorum.device.votes") == 0)) {
686 if (safe_atoq(
value, &val, val_type) != 0) {
690 goto icmap_set_error;
694 if ((strcmp(path,
"quorum.device.master_wins") == 0)) {
696 if (safe_atoq(
value, &val, val_type) != 0) {
700 goto icmap_set_error;
706 if ((strcmp(path,
"totem.version") == 0) ||
707 (strcmp(path,
"totem.nodeid") == 0) ||
708 (strcmp(path,
"totem.threads") == 0) ||
709 (strcmp(path,
"totem.token") == 0) ||
710 (strcmp(path,
"totem.token_coefficient") == 0) ||
711 (strcmp(path,
"totem.token_retransmit") == 0) ||
712 (strcmp(path,
"totem.token_warning") == 0) ||
713 (strcmp(path,
"totem.hold") == 0) ||
714 (strcmp(path,
"totem.token_retransmits_before_loss_const") == 0) ||
715 (strcmp(path,
"totem.join") == 0) ||
716 (strcmp(path,
"totem.send_join") == 0) ||
717 (strcmp(path,
"totem.consensus") == 0) ||
718 (strcmp(path,
"totem.merge") == 0) ||
719 (strcmp(path,
"totem.downcheck") == 0) ||
720 (strcmp(path,
"totem.fail_recv_const") == 0) ||
721 (strcmp(path,
"totem.seqno_unchanged_const") == 0) ||
722 (strcmp(path,
"totem.rrp_token_expired_timeout") == 0) ||
723 (strcmp(path,
"totem.rrp_problem_count_timeout") == 0) ||
724 (strcmp(path,
"totem.rrp_problem_count_threshold") == 0) ||
725 (strcmp(path,
"totem.rrp_problem_count_mcast_threshold") == 0) ||
726 (strcmp(path,
"totem.rrp_autorecovery_check_timeout") == 0) ||
727 (strcmp(path,
"totem.heartbeat_failures_allowed") == 0) ||
728 (strcmp(path,
"totem.max_network_delay") == 0) ||
729 (strcmp(path,
"totem.window_size") == 0) ||
730 (strcmp(path,
"totem.max_messages") == 0) ||
731 (strcmp(path,
"totem.miss_count_const") == 0) ||
732 (strcmp(path,
"totem.knet_pmtud_interval") == 0) ||
733 (strcmp(path,
"totem.knet_mtu") == 0) ||
734 (strcmp(path,
"totem.knet_compression_threshold") == 0) ||
735 (strcmp(path,
"totem.netmtu") == 0)) {
737 if (safe_atoq(
value, &val, val_type) != 0) {
741 goto icmap_set_error;
745 if (strcmp(path,
"totem.knet_compression_level") == 0) {
747 if (safe_atoq(
value, &val, val_type) != 0) {
751 goto icmap_set_error;
755 if (strcmp(path,
"totem.config_version") == 0) {
756 if (str_to_ull(
value, &ull) != 0) {
760 goto icmap_set_error;
764 if (strcmp(path,
"totem.ip_version") == 0) {
765 if ((strcmp(
value,
"ipv4") != 0) &&
766 (strcmp(
value,
"ipv6") != 0) &&
767 (strcmp(
value,
"ipv6-4") != 0) &&
768 (strcmp(
value,
"ipv4-6") != 0)) {
769 *error_string =
"Invalid ip_version type";
774 if (strcmp(path,
"totem.crypto_model") == 0) {
775 if (handle_crypto_model(
value, error_string) != 0) {
780 if (strcmp(path,
"totem.crypto_cipher") == 0) {
781 if ((strcmp(
value,
"none") != 0) &&
782 (strcmp(
value,
"aes256") != 0) &&
783 (strcmp(
value,
"aes192") != 0) &&
784 (strcmp(
value,
"aes128") != 0)) {
785 *error_string =
"Invalid cipher type. "
786 "Should be none, aes256, aes192 or aes128";
791 if (strcmp(path,
"totem.crypto_hash") == 0) {
792 if ((strcmp(
value,
"none") != 0) &&
793 (strcmp(
value,
"md5") != 0) &&
794 (strcmp(
value,
"sha1") != 0) &&
795 (strcmp(
value,
"sha256") != 0) &&
796 (strcmp(
value,
"sha384") != 0) &&
797 (strcmp(
value,
"sha512") != 0)) {
798 *error_string =
"Invalid hash type. "
799 "Should be none, md5, sha1, sha256, sha384 or sha512";
805 if (strcmp(path,
"totem.knet_compression_model") == 0) {
806 if (handle_compress_model(
value, error_string) != 0) {
814 if (strcmp(path,
"system.qb_ipc_type") == 0) {
815 if ((strcmp(
value,
"native") != 0) &&
816 (strcmp(
value,
"shm") != 0) &&
817 (strcmp(
value,
"socket") != 0)) {
818 *error_string =
"Invalid system.qb_ipc_type";
823 if (strcmp(path,
"system.sched_rr") == 0) {
824 if ((strcmp(
value,
"yes") != 0) &&
825 (strcmp(
value,
"no") != 0)) {
826 *error_string =
"Invalid system.sched_rr value";
831 if (strcmp(path,
"system.move_to_root_cgroup") == 0) {
832 if ((strcmp(
value,
"yes") != 0) &&
833 (strcmp(
value,
"no") != 0) &&
834 (strcmp(
value,
"auto") != 0)) {
835 *error_string =
"Invalid system.move_to_root_cgroup";
840 if (strcmp(path,
"system.allow_knet_handle_fallback") == 0) {
841 if ((strcmp(
value,
"yes") != 0) &&
842 (strcmp(
value,
"no") != 0)) {
843 *error_string =
"Invalid system.allow_knet_handle_fallback";
851 if (strcmp(path,
"totem.interface.linknumber") == 0) {
853 if (safe_atoq(
value, &val, val_type) != 0) {
860 if (strcmp(path,
"totem.interface.bindnetaddr") == 0) {
864 if (strcmp(path,
"totem.interface.mcastaddr") == 0) {
868 if (strcmp(path,
"totem.interface.broadcast") == 0) {
872 if (strcmp(path,
"totem.interface.mcastport") == 0) {
874 if (safe_atoq(
value, &val, val_type) != 0) {
880 if (strcmp(path,
"totem.interface.ttl") == 0) {
882 if (safe_atoq(
value, &val, val_type) != 0) {
888 if (strcmp(path,
"totem.interface.knet_link_priority") == 0) {
890 if (safe_atoq(
value, &val, val_type) != 0) {
896 if (strcmp(path,
"totem.interface.knet_ping_interval") == 0) {
898 if (safe_atoq(
value, &val, val_type) != 0) {
904 if (strcmp(path,
"totem.interface.knet_ping_timeout") == 0) {
906 if (safe_atoq(
value, &val, val_type) != 0) {
912 if (strcmp(path,
"totem.interface.knet_ping_precision") == 0) {
914 if (safe_atoq(
value, &val, val_type) != 0) {
920 if (strcmp(path,
"totem.interface.knet_pong_count") == 0) {
922 if (safe_atoq(
value, &val, val_type) != 0) {
928 if (strcmp(path,
"totem.interface.knet_transport") == 0) {
935 if (strcmp(key,
"subsys") == 0) {
937 if (data->
subsys == NULL) {
938 *error_string =
"Can't alloc memory";
943 kv_item = malloc(
sizeof(*kv_item));
944 if (kv_item == NULL) {
945 *error_string =
"Can't alloc memory";
949 memset(kv_item, 0,
sizeof(*kv_item));
951 kv_item->
key = strdup(key);
953 if (kv_item->
key == NULL || kv_item->
value == NULL) {
955 *error_string =
"Can't alloc memory";
959 qb_list_init(&kv_item->
list);
965 if (strcmp(key,
"subsys") == 0) {
967 if (data->
subsys == NULL) {
968 *error_string =
"Can't alloc memory";
972 }
else if (strcmp(key,
"name") == 0) {
975 *error_string =
"Can't alloc memory";
980 kv_item = malloc(
sizeof(*kv_item));
981 if (kv_item == NULL) {
982 *error_string =
"Can't alloc memory";
986 memset(kv_item, 0,
sizeof(*kv_item));
988 kv_item->
key = strdup(key);
990 if (kv_item->
key == NULL || kv_item->
value == NULL) {
992 *error_string =
"Can't alloc memory";
996 qb_list_init(&kv_item->
list);
1002 if (strcmp(key,
"uid") == 0) {
1003 uid = uid_determine(
value);
1005 *error_string = error_string_response;
1011 goto icmap_set_error;
1014 }
else if (strcmp(key,
"gid") == 0) {
1015 gid = gid_determine(
value);
1017 *error_string = error_string_response;
1023 goto icmap_set_error;
1027 *error_string =
"uidgid: Only uid and gid are allowed items";
1032 if (strcmp(key,
"memberaddr") != 0) {
1033 *error_string =
"Only memberaddr is allowed in member section";
1038 kv_item = malloc(
sizeof(*kv_item));
1039 if (kv_item == NULL) {
1040 *error_string =
"Can't alloc memory";
1044 memset(kv_item, 0,
sizeof(*kv_item));
1046 kv_item->
key = strdup(key);
1048 if (kv_item->
key == NULL || kv_item->
value == NULL) {
1050 *error_string =
"Can't alloc memory";
1054 qb_list_init(&kv_item->
list);
1062 if ((strcmp(key,
"nodeid") == 0) ||
1063 (strcmp(key,
"quorum_votes") == 0)) {
1065 if (safe_atoq(
value, &val, val_type) != 0) {
1070 goto icmap_set_error;
1075 if (add_as_string) {
1077 goto icmap_set_error;
1083 if (strcmp(key,
"watchdog_timeout") == 0) {
1085 if (safe_atoq(
value, &val, val_type) != 0) {
1089 goto icmap_set_error;
1096 if (strcmp(key,
"poll_period") == 0) {
1097 if (str_to_ull(
value, &ull) != 0) {
1101 goto icmap_set_error;
1108 if (strcmp(key,
"poll_period") == 0) {
1109 if (str_to_ull(
value, &ull) != 0) {
1113 goto icmap_set_error;
1120 if (add_as_string) {
1122 goto icmap_set_error;
1127 if (strcmp(path,
"totem.interface") == 0) {
1140 if (strcmp(path,
"totem") == 0) {
1143 if (strcmp(path,
"system") == 0) {
1146 if (strcmp(path,
"logging.logger_subsys") == 0) {
1151 if (strcmp(path,
"logging.logging_daemon") == 0) {
1157 if (strcmp(path,
"uidgid") == 0) {
1160 if (strcmp(path,
"totem.interface.member") == 0) {
1163 if (strcmp(path,
"quorum") == 0) {
1166 if (strcmp(path,
"quorum.device") == 0) {
1169 if (strcmp(path,
"nodelist") == 0) {
1173 if (strcmp(path,
"nodelist.node") == 0) {
1176 if (strcmp(path,
"resources") == 0) {
1179 if (strcmp(path,
"resources.system") == 0) {
1182 if (strcmp(path,
"resources.system.memory_used") == 0) {
1185 if (strcmp(path,
"resources.process") == 0) {
1188 if (strcmp(path,
"resources.process.memory_used") == 0) {
1206 if (cs_err !=
CS_OK) {
1207 goto icmap_set_error;
1219 if (cs_err !=
CS_OK) {
1220 goto icmap_set_error;
1232 if (cs_err !=
CS_OK) {
1233 goto icmap_set_error;
1242 goto icmap_set_error;
1246 if (data->
ttl > -1) {
1250 goto icmap_set_error;
1258 goto icmap_set_error;
1266 goto icmap_set_error;
1274 goto icmap_set_error;
1282 goto icmap_set_error;
1290 goto icmap_set_error;
1299 if (cs_err !=
CS_OK) {
1300 goto icmap_set_error;
1313 free(kv_item->
value);
1318 if (cs_err !=
CS_OK) {
1319 goto icmap_set_error;
1325 if (data->
subsys == NULL) {
1326 *error_string =
"No subsys key in logger_subsys directive";
1338 free(kv_item->
value);
1342 if (cs_err !=
CS_OK) {
1343 goto icmap_set_error;
1353 if (cs_err !=
CS_OK) {
1354 goto icmap_set_error;
1359 *error_string =
"No name key in logging_daemon directive";
1367 if (data->
subsys == NULL) {
1374 "logging.logging_daemon.%s.%s",
1380 "logging.logger_subsys.%s.%s",
1385 "logging.logging_daemon.%s.%s.%s",
1392 free(kv_item->
value);
1396 if (cs_err !=
CS_OK) {
1397 goto icmap_set_error;
1401 if (data->
subsys == NULL) {
1418 if (cs_err !=
CS_OK) {
1422 goto icmap_set_error;
1433 if (cs_err !=
CS_OK) {
1434 goto icmap_set_error;
1472 min_val = max_val = 0;
1477 assert(safe_atoq_range(val_type, &min_val, &max_val) == 0);
1479 if (snprintf(formated_err,
sizeof(formated_err),
1480 "Value of key \"%s\" is expected to be integer in range (%lld..%lld), but \"%s\" was given",
1481 key_name, min_val, max_val,
value) >=
sizeof(formated_err)) {
1482 *error_string =
"Can't format parser error message";
1484 *error_string = formated_err;
1490 if (snprintf(formated_err,
sizeof(formated_err),
1491 "Can't store key \"%s\" into icmap, returned error is %s",
1492 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1493 *error_string =
"Can't format parser error message";
1495 *error_string = formated_err;
1501static int uidgid_config_parser_cb(
const char *path,
1506 const char **error_string,
1512 static char formated_err[256];
1521 if (strcmp(path,
"uidgid.uid") == 0) {
1522 uid = uid_determine(
value);
1524 *error_string = error_string_response;
1530 goto icmap_set_error;
1532 }
else if (strcmp(path,
"uidgid.gid") == 0) {
1533 gid = gid_determine(
value);
1535 *error_string = error_string_response;
1541 goto icmap_set_error;
1544 *error_string =
"uidgid: Only uid and gid are allowed items";
1549 if (strcmp(path,
"uidgid") != 0) {
1550 *error_string =
"uidgid: Can't add subsection different than uidgid";
1561 if (snprintf(formated_err,
sizeof(formated_err),
1562 "Can't store key \"%s\" into icmap, returned error is %s",
1563 key_name,
cs_strerror(cs_err)) >=
sizeof(formated_err)) {
1564 *error_string =
"Can't format parser error message";
1566 *error_string = formated_err;
1572static int read_uidgid_files_into_icmap(
1573 const char **error_string,
1579 struct dirent *dirent;
1580 char filename[PATH_MAX + FILENAME_MAX + 1];
1581 char uidgid_dirname[PATH_MAX + FILENAME_MAX + 1];
1583 struct stat stat_buf;
1591 res = snprintf(filename,
sizeof(filename),
"%s",
1593 if (res >=
sizeof(filename)) {
1594 *error_string =
"uidgid.d path too long";
1599 dirname_res = dirname(filename);
1601 res = snprintf(uidgid_dirname,
sizeof(uidgid_dirname),
"%s/%s",
1602 dirname_res,
"uidgid.d");
1603 if (res >=
sizeof(uidgid_dirname)) {
1604 *error_string =
"uidgid.d path too long";
1609 dp = opendir (uidgid_dirname);
1614 for (dirent = readdir(dp);
1616 dirent = readdir(dp)) {
1618 res = snprintf(filename,
sizeof (filename),
"%s/%s", uidgid_dirname, dirent->d_name);
1619 if (res >=
sizeof(filename)) {
1621 *error_string =
"uidgid.d dirname path too long";
1625 res = stat (filename, &stat_buf);
1626 if (res == 0 && S_ISREG(stat_buf.st_mode)) {
1628 fp = fopen (filename,
"r");
1629 if (fp == NULL)
continue;
1634 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1635 uidgid_config_parser_cb, config_map, NULL);
1652static int read_config_file_into_icmap(
1653 const char **error_string,
1657 const char *filename;
1658 char *error_reason = error_string_response;
1667 fp = fopen (filename,
"r");
1669 char error_str[100];
1670 const char *error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1671 snprintf (error_reason,
sizeof(error_string_response),
1672 "Can't read file %s: %s",
1673 filename, error_ptr);
1674 *error_string = error_reason;
1681 res = parse_section(fp, filename, &line_no, key_name, error_string, 0, state,
1682 main_config_parser_cb, config_map, &data);
1687 res = read_uidgid_files_into_icmap(error_string, config_map);
1691 snprintf (error_reason,
sizeof(error_string_response),
1692 "Successfully read main configuration file '%s'.", filename);
1693 *error_string = error_reason;
int(* parser_cb_f)(const char *path, char *key, char *value, enum main_cp_cb_data_state *state, enum parser_cb_type type, const char **error_string, icmap_map_t config_map, void *user_data)
@ MAIN_CP_CB_DATA_STATE_LOGGING_DAEMON
@ MAIN_CP_CB_DATA_STATE_RESOURCES_PROCESS_MEMUSED
@ MAIN_CP_CB_DATA_STATE_RESOURCES_SYSTEM_MEMUSED
@ MAIN_CP_CB_DATA_STATE_MEMBER
@ MAIN_CP_CB_DATA_STATE_UIDGID
@ MAIN_CP_CB_DATA_STATE_INTERFACE
@ MAIN_CP_CB_DATA_STATE_NORMAL
@ MAIN_CP_CB_DATA_STATE_PLOAD
@ MAIN_CP_CB_DATA_STATE_LOGGER_SUBSYS
@ MAIN_CP_CB_DATA_STATE_TOTEM
@ MAIN_CP_CB_DATA_STATE_RESOURCES_PROCESS
@ MAIN_CP_CB_DATA_STATE_SYSTEM
@ MAIN_CP_CB_DATA_STATE_QUORUM
@ MAIN_CP_CB_DATA_STATE_QDEVICE
@ MAIN_CP_CB_DATA_STATE_RESOURCES_SYSTEM
@ MAIN_CP_CB_DATA_STATE_NODELIST_NODE
@ MAIN_CP_CB_DATA_STATE_RESOURCES
@ MAIN_CP_CB_DATA_STATE_NODELIST
int coroparse_configparse(icmap_map_t config_map, const char **error_string)
@ PARSER_CB_SECTION_START
const char * cs_strerror(cs_error_t err)
cs_strerror
cs_error_t
The cs_error_t enum.
cs_error_t icmap_set_uint16_r(const icmap_map_t map, const char *key_name, uint16_t value)
cs_error_t icmap_set_uint32_r(const icmap_map_t map, const char *key_name, uint32_t value)
icmap_value_types_t
Possible types of value.
cs_error_t icmap_set_uint8_r(const icmap_map_t map, const char *key_name, uint8_t value)
cs_error_t icmap_set_uint64_r(const icmap_map_t map, const char *key_name, uint64_t value)
cs_error_t icmap_set_int32_r(const icmap_map_t map, const char *key_name, int32_t value)
cs_error_t icmap_set_string_r(const icmap_map_t map, const char *key_name, const char *value)
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
const char * corosync_get_config_file(void)
struct qb_list_head logger_subsys_items_head
char * logging_daemon_name
struct qb_list_head member_items_head
int util_is_valid_knet_crypto_model(const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)
int util_is_valid_knet_compress_model(const char *val, const char **list_str, int machine_parseable_str, const char *error_string_prefix, const char **error_string)