mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* printk() without KERN_ prefixes? (in 2.5.59) and Q: small kernel image doc
@ 2003-01-21  8:58 Ph. Marek
  2003-01-21  9:23 ` Keith Owens
  0 siblings, 1 reply; 4+ messages in thread
From: Ph. Marek @ 2003-01-21  8:58 UTC (permalink / raw)
  To: linux-kernel

Hello everybody,

until now I believed that all printk()'s should have a KERN_ prefix - but to 
my surprise it ain't so:
	grep printk -r . | grep -v "KERN_" | wc -l
	  29932
	grep printk -r . | grep -v "KERN_" | cut -d: -f1 | uniq | wc -l
	   2636
so there are ~ 30 000 printk() lines in 2600 files which don't have such a 
specifier.

Should they be fixed to KERN_INFO or some such? I'm willing to contribute a 
patch (which will be done by script, of course). Or am I missing something 
and they shall stay as they are?

I'm looking at this part as I'm trying to get a smaller kernel image, as my 
boot media (1.44 MB disk :-( is getting full (yes I know that there's a lot I 
can do about userspace too :-) and so I'm thinking about dropping all 
KERN_DEBUG, maybe KERN_INFO and possible KERN_NOTICE to save some space. I 
remember having read some ideas (and possibly a web reference) on lkml in 
mid-2002 but couldn't find them yet.


Anyway, are there some other resources on the web for building small kernel's? 
(that is, small kernel images, not for use in small machines). I already 
searched a bit and found some sites (mulinux, superant/smalllinux, 
linuxrouter, linux embedding, small unix, ...)

I know that I could use an older kernel (2.0 or 2.2) but because of driver 
maturity (ie. workarounds for bugs in recent hardware) and performance I'd 
like to use current kernels.



Regards,

Phil



PS: Highlights are below (more than 100 occurances)

    102 ./drivers/scsi/qlogicfc.c
    103 ./drivers/block/floppy.c
    104 ./drivers/atm/idt77252.c
    104 ./drivers/cdrom/sjcd.c
    106 ./drivers/char/rio/rioinit.c
    107 ./net/atm/mpc.c
    109 ./drivers/message/i2o/i2o_core.c
    110 ./drivers/char/stallion.c
    114 ./drivers/sbus/char/aurora.c
    114 ./drivers/cdrom/aztcd.c
    116 ./drivers/char/pcmcia/synclink_cs.c
    117 ./drivers/char/serial167.c
    122 ./drivers/scsi/AM53C974.c
    130 ./drivers/message/fusion/mptbase.c
    136 ./drivers/char/synclinkmp.c
    142 ./drivers/char/synclink.c
    144 ./drivers/message/fusion/mptscsih.c
    145 ./drivers/scsi/ncr53c8xx.c
    147 ./arch/ia64/kernel/perfmon.c
    149 ./drivers/scsi/sym53c8xx.c
    154 ./drivers/net/hp100.c
    164 ./sound/oss/cs46xx.c
    166 ./drivers/atm/iphase.c
    180 ./drivers/scsi/aha152x.c
    184 ./drivers/char/cyclades.c
    184 ./drivers/char/rio/rioctrl.c
    204 ./drivers/scsi/53c7xx.c
    206 ./drivers/scsi/osst.c
    208 ./drivers/scsi/53c7,8xx.c
    217 ./drivers/scsi/qla1280.c
    221 ./drivers/scsi/cpqfcTSworker.c
    229 ./fs/jffs/intrep.c
    230 ./drivers/scsi/aic7xxx_old.c
    253 ./crypto/tcrypt.c



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: printk() without KERN_ prefixes? (in 2.5.59) and Q: small kernel image doc
  2003-01-21  8:58 printk() without KERN_ prefixes? (in 2.5.59) and Q: small kernel image doc Ph. Marek
@ 2003-01-21  9:23 ` Keith Owens
  2003-01-24 11:32   ` [PATCH available] Re: printk() without KERN_ prefixes? (in 2.5.59) Ph. Marek
  2003-02-12 15:10   ` [PATCHes] printk() without KERN_ prefixes for 2.5.60 Ph. Marek
  0 siblings, 2 replies; 4+ messages in thread
From: Keith Owens @ 2003-01-21  9:23 UTC (permalink / raw)
  To: Ph. Marek; +Cc: linux-kernel

On Tue, 21 Jan 2003 09:58:43 +0100, 
"Ph. Marek" <philipp.marek@bmlv.gv.at> wrote:
>Should they be fixed to KERN_INFO or some such? I'm willing to contribute a 
>patch (which will be done by script, of course). Or am I missing something 
>and they shall stay as they are?

Do not blindly add KERN_*.  Some prints are done with multiple calls to
printk(), only the first call should have KERN_*, otherwise you get
lines like this, with embedded '<n>' strings.

  /dev/xscsi/pci01.00.0-1/target0/lun0:<6> p1<6> p2<6> p3<6> p4 <<6> p5<6> p6<6> p7 >


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH available] Re: printk() without KERN_ prefixes? (in 2.5.59)
  2003-01-21  9:23 ` Keith Owens
@ 2003-01-24 11:32   ` Ph. Marek
  2003-02-12 15:10   ` [PATCHes] printk() without KERN_ prefixes for 2.5.60 Ph. Marek
  1 sibling, 0 replies; 4+ messages in thread
From: Ph. Marek @ 2003-01-24 11:32 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

> >Should they be fixed to KERN_INFO or some such? I'm willing to contribute
> > a patch (which will be done by script, of course). Or am I missing
> > something and they shall stay as they are?
>
> Do not blindly add KERN_*.  Some prints are done with multiple calls to
> printk(), only the first call should have KERN_*, otherwise you get
> lines like this, with embedded '<n>' strings.

Well, I wrote a perl-script (available on request) which searches for missing 
KERN_ values.
It does this by reading filenames from STDIN, reading the files, extracting 
every function from there and checking if after \n is a KERN_-value (assuming 
that every function starts from a fresh line). If there is one missing, 
KERN_DEBUG is inserted.

my simple script was unable to do some files in the arch/ia64 tree and some 
others because using #if with mis-aligned { and }. example from 
sound/isa/opti9xx/opti92x-ad1848.c
	#ifdef __ISAPNP__
	        if (isapnp && (hw = snd_card_opti9xx_isapnp(chip)) > 0) {
	 ...
	        } else {
	#endif  /* __ISAPNP__ */
	...
	#ifdef __ISAPNP__
	        }
	#endif  /* __ISAPNP__ */
and it just doesn't check such constructs.

Furthermore it destroys some files (don't know why atm), but these are 
manually excluded from the patch, which is 3933078 bytes (bzipped2 699170).

This patch has NOT all occurances fixed!

from diffstat:
  1908 files changed, 13568 insertions(+), 13567 deletions(-)

So I think it not really useful to just post this patch to the list.


I think I'll cut it at subdirectory levels in pieces (ie arch/ia64, arch/i386, 
drivers/net, drivers/scsi ...).
I should have them available some time monday for the interested.


Comments?



Regards,

Phil




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHes] printk() without KERN_ prefixes for 2.5.60
  2003-01-21  9:23 ` Keith Owens
  2003-01-24 11:32   ` [PATCH available] Re: printk() without KERN_ prefixes? (in 2.5.59) Ph. Marek
@ 2003-02-12 15:10   ` Ph. Marek
  1 sibling, 0 replies; 4+ messages in thread
From: Ph. Marek @ 2003-02-12 15:10 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

I've again generated a patch which changes printk() without KERN_ prefixes to 
include these.

It is available upon request; diffstat appended.
summary:
	 1922 files changed, 13863 insertions(+), 13862 deletions(-)


Regards,

Phil




[-- Attachment #2: _diffstat.txt.gz --]
[-- Type: application/x-gzip, Size: 15966 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-12 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-21  8:58 printk() without KERN_ prefixes? (in 2.5.59) and Q: small kernel image doc Ph. Marek
2003-01-21  9:23 ` Keith Owens
2003-01-24 11:32   ` [PATCH available] Re: printk() without KERN_ prefixes? (in 2.5.59) Ph. Marek
2003-02-12 15:10   ` [PATCHes] printk() without KERN_ prefixes for 2.5.60 Ph. Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®