···1212 The logged line can be prefixed with a <N> syslog prefix, which1313 carries the syslog priority and facility. The single decimal1414 prefix number is composed of the 3 lowest bits being the syslog1515- priority and the higher bits the syslog facility number.1515+ priority and the next 8 bits the syslog facility number.16161717 If no prefix is given, the priority number is the default kernel1818 log priority and the facility number is set to LOG_USER (1). It···9090 +sound:card0 - subsystem:devname91919292 The flags field carries '-' by default. A 'c' indicates a9393- fragment of a line. All following fragments are flagged with9494- '+'. Note, that these hints about continuation lines are not9595- necessarily correct, and the stream could be interleaved with9696- unrelated messages, but merging the lines in the output9797- usually produces better human readable results. A similar9898- logic is used internally when messages are printed to the9999- console, /proc/kmsg or the syslog() syscall.9393+ fragment of a line. Note, that these hints about continuation9494+ lines are not necessarily correct, and the stream could be9595+ interleaved with unrelated messages, but merging the lines in9696+ the output usually produces better human readable results. A9797+ similar logic is used internally when messages are printed to9898+ the console, /proc/kmsg or the syslog() syscall.10099101100 By default, kernel tries to avoid fragments by concatenating102101 when it can and fragments are rare; however, when extended
+11-4
kernel/printk/braille.c
···11111212int _braille_console_setup(char **str, char **brl_options)1313{1414- if (!strncmp(*str, "brl,", 4)) {1414+ size_t len;1515+1616+ len = str_has_prefix(*str, "brl,");1717+ if (len) {1518 *brl_options = "";1616- *str += 4;1717- } else if (!strncmp(*str, "brl=", 4)) {1818- *brl_options = *str + 4;1919+ *str += len;2020+ return 0;2121+ }2222+2323+ len = str_has_prefix(*str, "brl=");2424+ if (len) {2525+ *brl_options = *str + len;1926 *str = strchr(*brl_options, ',');2027 if (!*str) {2128 pr_err("need port name after brl=\n");
+18-8
kernel/printk/printk.c
···118118119119static int __control_devkmsg(char *str)120120{121121+ size_t len;122122+121123 if (!str)122124 return -EINVAL;123125124124- if (!strncmp(str, "on", 2)) {126126+ len = str_has_prefix(str, "on");127127+ if (len) {125128 devkmsg_log = DEVKMSG_LOG_MASK_ON;126126- return 2;127127- } else if (!strncmp(str, "off", 3)) {128128- devkmsg_log = DEVKMSG_LOG_MASK_OFF;129129- return 3;130130- } else if (!strncmp(str, "ratelimit", 9)) {131131- devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;132132- return 9;129129+ return len;133130 }131131+132132+ len = str_has_prefix(str, "off");133133+ if (len) {134134+ devkmsg_log = DEVKMSG_LOG_MASK_OFF;135135+ return len;136136+ }137137+138138+ len = str_has_prefix(str, "ratelimit");139139+ if (len) {140140+ devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;141141+ return len;142142+ }143143+134144 return -EINVAL;135145}136146