proc: Add nbcon support for /proc/consoles

BugLink: https://bugs.launchpad.net/bugs/2060704

Update /proc/consoles output to show 'W' if an nbcon write
callback is implemented (write_atomic or write_thread).

Also update /proc/consoles output to show 'N' if it is an
nbcon console.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Kevin Becker <kevin.becker@canonical.com>
This commit is contained in:
John Ogness
2023-09-26 13:31:00 +00:00
committed by Kevin Becker
parent a0c1baa05c
commit 03b98ce8da
+11 -3
View File
@@ -21,12 +21,14 @@ static int show_console_dev(struct seq_file *m, void *v)
{ CON_ENABLED, 'E' },
{ CON_CONSDEV, 'C' },
{ CON_BOOT, 'B' },
{ CON_NBCON, 'N' },
{ CON_PRINTBUFFER, 'p' },
{ CON_BRL, 'b' },
{ CON_ANYTIME, 'a' },
};
char flags[ARRAY_SIZE(con_flags) + 1];
struct console *con = v;
char con_write = '-';
unsigned int a;
dev_t dev = 0;
@@ -57,9 +59,15 @@ static int show_console_dev(struct seq_file *m, void *v)
seq_setwidth(m, 21 - 1);
seq_printf(m, "%s%d", con->name, con->index);
seq_pad(m, ' ');
seq_printf(m, "%c%c%c (%s)", con->read ? 'R' : '-',
con->write ? 'W' : '-', con->unblank ? 'U' : '-',
flags);
if (con->flags & CON_NBCON) {
if (con->write_atomic || con->write_thread)
con_write = 'W';
} else {
if (con->write)
con_write = 'W';
}
seq_printf(m, "%c%c%c (%s)", con->read ? 'R' : '-', con_write,
con->unblank ? 'U' : '-', flags);
if (dev)
seq_printf(m, " %4d:%d", MAJOR(dev), MINOR(dev));