lkml.org 
[lkml]   [1999]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: "CONFIG_PROCFS" problem in 2.3.18ac8
On Wed, 22 Sep 1999, Matti Aarnio wrote:

> As a side note, job for a aspiring kernel hacker:

What about aspiring perl hackers? :)


> In the system (for i386) there are now 565 'CONFIG_.*' entries and
> TWO 'IDEDMA_.*' entries. Scanning the system for such defines which
> are *NOT* defined in any configuration script file would be worthwhile
> job for somebody. Any takers ?

A simple perl hack that takes a list of files and greps them for CONFIG_,
each found is put in a hashtable of valid defines. Then search all *.[chS]
files for CONFIG_ and if not in the hash it is printed.

Is that anything like what you had in mind?

% ./cfg-scan.pl `find /usr/src/linux/ -name '*onfig.in'`
/usr/src/linux/include/linux/autoconf.h /usr/src/linux/.config

gives, on ac7:

/usr/src/linux/fs/locks.c: CONFIG_LOCK_MANDATORY
/usr/src/linux/fs/proc/root.c: CONFIG_SUN_OPENPROMFS_MODULE
/usr/src/linux/fs/proc/root.c: CONFIG_SUN_OPENPROMFS_MODULE
...

That will find a lot of bogus errors where people have used CONFIG_ for
their own defines, or things in comments.

And it is not a short list ... 1555
(with duplicates, and possibly incomplete "valid" list).

Btw, how do you count to 565 "legal" CONFIG_'s?

/Urban, waiting for someone who is good at perl to do the same in 4 lines ...
#!/usr/bin/perl -w
#
# Scan for undefined CONFIG_ values. Input a list of files that contain
# "legal" CONFIG_ definitions.
#
# Example:
# ./foo `find /usr/src/linux/ -name '*onfig.in'`
#

use strict;

my (%config, $srcdir);

$srcdir = "/usr/src/linux/";

#
# Build a list of valid configs
#
while(<>) {
if( /(CONFIG_[\w_]+)/ ) {
$config{"$1"} = 1;
}
if( /(IDEDMA_[\w_]+)/ ) {
$config{"$1"} = 1;
}
}


#
# Check the sources for CONFIG_'s not in the hash
#
my (@source, $file);

@source = `find $srcdir -name '\*.[chS]'`;
while ($file = shift @source) {
chomp($file);
open(FH, $file);
while(<FH>) {
if( /(CONFIG_[\w_]+)/ ) {
print "$file: $1\n"
unless defined($config{"$1"});
}
if( /(IDEDMA_[\w_]+)/ ) {
print "$file: $1\n"
unless defined($config{"$1"});
}
}
}
\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.047 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site