| 709 | }; |
| 710 | |
| 711 | static 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 */ |
| 735 | static void dump_console(enum console_print_type type, int max_loglevel, int print_unknown_logs) |
no test coverage detected