[PATCH] modify console_loglevel from commandline

Robert Minichino (rmini@joni.pasture.net)
Wed, 9 Dec 1998 00:33:02 -0500 (EST)


--Herd_of_Bison_879_000
Content-Type: TEXT/plain; charset=us-ascii
Content-MD5: vPkGPZK/IjkrOVLi2zxYOA==

These little patches (against 2.0.35 and 2.1.128, but should apply
cleanly towards later) allow changing the default console_loglevel with
kernel parameters. These should be simple enough to include in the
current 2.0 and 2.1 trees without disturbing anything.

Two new parameters are added, "quiet" which sets console_loglevel to 1,
and "loglevel=integer" which sets the console_loglevel to some integer
from 1 to 10. This lets me quiet down the boot process of my
distribution (as to not scare anyone) without having to patch the kernel,
and additionally allows me to change it from LILO without including
another entire kernel image.

--
Robert Minichino
Chief Engineer
Denarius Enterprises, Inc.
http://www.denarius.com/

--Herd_of_Bison_879_000 Content-Type: TEXT/plain; name="loglevel-patch-2.0"; charset=us-ascii; x-unix-mode=0777 Content-Description: loglevel-patch-2.0 Content-MD5: y9+zKGeIEZJpG0zLVcwqGA==

--- ../linux-2.0.35/init/main.c Thu Jul 23 14:00:33 1998 +++ init/main.c Wed Dec 9 00:35:39 1998 @@ -258,6 +258,15 @@ return(cur); } +int atoi(const char *num) { + int result = 0; + + while ( (*num >= '0') && (*num <= '9') ) + result = result * 10 + *(num++) - '0'; + + return result; +} + static void profile_setup(char *str, int *ints) { if (ints[0] > 0) @@ -741,6 +750,19 @@ } if (!strcmp(line,"debug")) { console_loglevel = 10; + continue; + } + if (!strcmp(line,"quiet")) { + console_loglevel = 1; + continue; + } + if (!strncmp(line,"loglevel=",9)) { + if ( atoi(line+9) > 0 ) + console_loglevel = atoi(line+9); + if ( console_loglevel < 0 ) + console_loglevel = 0; + else if ( console_loglevel > 10 ) + console_loglevel = 10; continue; } if (!strncmp(line,"init=",5)) {

--Herd_of_Bison_879_000 Content-Type: TEXT/plain; name="loglevel-patch-2.1"; charset=us-ascii; x-unix-mode=0777 Content-Description: loglevel-patch-2.1 Content-MD5: LtlKK3rfEHvT28RrPb3Dvw==

--- ../linux-pristine/init/main.c Wed Dec 9 00:42:27 1998 +++ init/main.c Wed Dec 9 00:48:12 1998 @@ -379,6 +379,15 @@ return(cur); } +int atoi(const char *num) { + int result = 0; + + while ( (*num >= '0') && (*num <= '9') ) + result = result * 10 + *(num++) - '0'; + + return result; +} + static void __init profile_setup(char *str, int *ints) { if (ints[0] > 0) @@ -1012,6 +1021,19 @@ } if (!strcmp(line,"debug")) { console_loglevel = 10; + continue; + } + if (!strcmp(line,"quiet")) { + console_loglevel = 1; + continue; + } + if (!strncmp(line,"loglevel=",9)) { + if ( atoi(line+9) > 0 ) + console_loglevel = atoi(line+9); + if ( console_loglevel < 0 ) + console_loglevel = 0; + else if ( console_loglevel > 10 ) + console_loglevel = 10; continue; } if (!strncmp(line,"init=",5)) {

--Herd_of_Bison_879_000--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/