Re: 2.1.31: Odd display of SCSI devices during boot

Kohtala Marko (Marko.Kohtala@ntc.nokia.com)
06 Apr 1997 19:56:04 +0300


Henrik Storner <storner@osiris.ping.dk> writes:

> Just got 2.1.31 running. During boot, the usual identification of my
...
> However, this time the lines with Vendor and Model info displayed
> as
> Vendor: C O N N E R
> with one space between all of the letters.

This appears to be a bug in my console patch that was applied to
2.1.31. A patch is at the end of this mail.

I changed the parameters to the functions that actually write to
different consoles to resemble more a write. This was to help making a
real console device which would copy the output written to
/dev/console to all console devices too. I decided to not write that,
yet at least, but changed the places where the writing happens to pass
the number of bytes to write.

The calculation of the number of bytes seems to go wrong if the printk
output has no newline at the end.

This is a patch I deviced. I am not right now at my machine and will
not be for hours, so I do not know if this even compiles. You can try
it anyway. Please let me know how it works and I'll send it to Linus.

diff -up linux/kernel/printk.c\~ linux/kernel/printk.c
--- linux/kernel/printk.c~ Sat Apr 5 23:14:20 1997
+++ linux/kernel/printk.c Sun Apr 6 19:43:33 1997
@@ -175,7 +175,7 @@ asmlinkage int printk(const char *fmt, .
{
va_list args;
int i;
- char *msg, *p, *buf_end;
+ char *msg, *p, *buf_end, *line_end;
static signed char msg_level = -1;
long flags;

@@ -202,6 +202,7 @@ asmlinkage int printk(const char *fmt, .
msg += 3;
msg_level = p[1] - '0';
}
+ line_end = buf_end;
for (; p < buf_end; p++) {
log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p;
if (log_size < LOG_BUF_LEN)
@@ -211,14 +212,16 @@ asmlinkage int printk(const char *fmt, .
log_start &= LOG_BUF_LEN-1;
}
logged_chars++;
- if (*p == '\n')
+ if (*p == '\n') {
+ line_end = p + 1;
break;
+ }
}
if (msg_level < console_loglevel && console_drivers) {
struct console *c = console_drivers;
while(c) {
if (c->write)
- c->write(msg, p - msg + 1);
+ c->write(msg, line_end - msg);
c = c->next;
}
}

-- 
---
Marko Kohtala - Marko.Kohtala@ntc.nokia.com, Marko.Kohtala@hut.fi