MCPcopy Create free account
hub / github.com/coreboot/coreboot / parse_loglevel

Function parse_loglevel

util/cbmem/cbmem.c:711–732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709};
710
711static int parse_loglevel(char *arg, int *print_unknown_logs)
712{
713 if (arg[0] == '+') {
714 *print_unknown_logs = 1;
715 arg++;
716 } else {
717 *print_unknown_logs = 0;
718 }
719
720 char *endptr;
721 int loglevel = strtol(arg, &endptr, 0);
722 if (*endptr == '\0' && loglevel >= BIOS_EMERG && loglevel <= BIOS_LOG_PREFIX_MAX_LEVEL)
723 return loglevel;
724
725 /* Only match first 3 characters so `NOTE` and `NOTICE` both match. */
726 for (int i = BIOS_EMERG; i <= BIOS_LOG_PREFIX_MAX_LEVEL; i++)
727 if (!strncasecmp(arg, bios_log_prefix[i], 3))
728 return i;
729
730 *print_unknown_logs = 1;
731 return BIOS_NEVER;
732}
733
734/* dump the cbmem console */
735static void dump_console(enum console_print_type type, int max_loglevel, int print_unknown_logs)

Callers 1

mainFunction · 0.85

Calls 2

strncasecmpFunction · 0.85
strtolFunction · 0.50

Tested by

no test coverage detected