Merge branch 'for-5.4' into for-linus

This commit is contained in:
Petr Mladek 2019-09-16 12:54:25 +02:00
commit ae88de56a1
5 changed files with 51 additions and 23 deletions

View File

@ -12,7 +12,7 @@ Description: The /dev/kmsg character device node provides userspace access
The logged line can be prefixed with a <N> syslog prefix, which The logged line can be prefixed with a <N> syslog prefix, which
carries the syslog priority and facility. The single decimal carries the syslog priority and facility. The single decimal
prefix number is composed of the 3 lowest bits being the syslog prefix number is composed of the 3 lowest bits being the syslog
priority and the higher bits the syslog facility number. priority and the next 8 bits the syslog facility number.
If no prefix is given, the priority number is the default kernel If no prefix is given, the priority number is the default kernel
log priority and the facility number is set to LOG_USER (1). It log priority and the facility number is set to LOG_USER (1). It
@ -90,13 +90,12 @@ Description: The /dev/kmsg character device node provides userspace access
+sound:card0 - subsystem:devname +sound:card0 - subsystem:devname
The flags field carries '-' by default. A 'c' indicates a The flags field carries '-' by default. A 'c' indicates a
fragment of a line. All following fragments are flagged with fragment of a line. Note, that these hints about continuation
'+'. Note, that these hints about continuation lines are not lines are not necessarily correct, and the stream could be
necessarily correct, and the stream could be interleaved with interleaved with unrelated messages, but merging the lines in
unrelated messages, but merging the lines in the output the output usually produces better human readable results. A
usually produces better human readable results. A similar similar logic is used internally when messages are printed to
logic is used internally when messages are printed to the the console, /proc/kmsg or the syslog() syscall.
console, /proc/kmsg or the syslog() syscall.
By default, kernel tries to avoid fragments by concatenating By default, kernel tries to avoid fragments by concatenating
when it can and fragments are rare; however, when extended when it can and fragments are rare; however, when extended

View File

@ -11,11 +11,18 @@
int _braille_console_setup(char **str, char **brl_options) int _braille_console_setup(char **str, char **brl_options)
{ {
if (!strncmp(*str, "brl,", 4)) { size_t len;
len = str_has_prefix(*str, "brl,");
if (len) {
*brl_options = ""; *brl_options = "";
*str += 4; *str += len;
} else if (!strncmp(*str, "brl=", 4)) { return 0;
*brl_options = *str + 4; }
len = str_has_prefix(*str, "brl=");
if (len) {
*brl_options = *str + len;
*str = strchr(*brl_options, ','); *str = strchr(*brl_options, ',');
if (!*str) { if (!*str) {
pr_err("need port name after brl=\n"); pr_err("need port name after brl=\n");

View File

@ -118,19 +118,29 @@ static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
static int __control_devkmsg(char *str) static int __control_devkmsg(char *str)
{ {
size_t len;
if (!str) if (!str)
return -EINVAL; return -EINVAL;
if (!strncmp(str, "on", 2)) { len = str_has_prefix(str, "on");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_ON; devkmsg_log = DEVKMSG_LOG_MASK_ON;
return 2; return len;
} else if (!strncmp(str, "off", 3)) {
devkmsg_log = DEVKMSG_LOG_MASK_OFF;
return 3;
} else if (!strncmp(str, "ratelimit", 9)) {
devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
return 9;
} }
len = str_has_prefix(str, "off");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_OFF;
return len;
}
len = str_has_prefix(str, "ratelimit");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
return len;
}
return -EINVAL; return -EINVAL;
} }

View File

@ -455,6 +455,11 @@ dentry(void)
test("foo", "%pd", &test_dentry[0]); test("foo", "%pd", &test_dentry[0]);
test("foo", "%pd2", &test_dentry[0]); test("foo", "%pd2", &test_dentry[0]);
test("(null)", "%pd", NULL);
test("(efault)", "%pd", PTR_INVALID);
test("(null)", "%pD", NULL);
test("(efault)", "%pD", PTR_INVALID);
test("romeo", "%pd", &test_dentry[3]); test("romeo", "%pd", &test_dentry[3]);
test("alfa/romeo", "%pd2", &test_dentry[3]); test("alfa/romeo", "%pd2", &test_dentry[3]);
test("bravo/alfa/romeo", "%pd3", &test_dentry[3]); test("bravo/alfa/romeo", "%pd3", &test_dentry[3]);

View File

@ -869,6 +869,15 @@ char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_sp
return widen_string(buf, n, end, spec); return widen_string(buf, n, end, spec);
} }
static noinline_for_stack
char *file_dentry_name(char *buf, char *end, const struct file *f,
struct printf_spec spec, const char *fmt)
{
if (check_pointer(&buf, end, f, spec))
return buf;
return dentry_name(buf, end, f->f_path.dentry, spec, fmt);
}
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
static noinline_for_stack static noinline_for_stack
char *bdev_name(char *buf, char *end, struct block_device *bdev, char *bdev_name(char *buf, char *end, struct block_device *bdev,
@ -2166,9 +2175,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
case 'C': case 'C':
return clock(buf, end, ptr, spec, fmt); return clock(buf, end, ptr, spec, fmt);
case 'D': case 'D':
return dentry_name(buf, end, return file_dentry_name(buf, end, ptr, spec, fmt);
((const struct file *)ptr)->f_path.dentry,
spec, fmt);
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
case 'g': case 'g':
return bdev_name(buf, end, ptr, spec, fmt); return bdev_name(buf, end, ptr, spec, fmt);