UBUNTU: Ubuntu-2.6.38-12.51
[linux-flexiantxendom0-natty.git] / scripts / headers_check.pl
index 4414c43..7957e7a 100644 (file)
@@ -2,7 +2,7 @@
 #
 # headers_check.pl execute a number of trivial consistency checks
 #
-# Usage: headers_check.pl dir [files...]
+# Usage: headers_check.pl dir arch [files...]
 # dir:   dir to look for included files
 # arch:  architecture
 # files: list of files to check
@@ -28,19 +28,20 @@ my $lineno = 0;
 my $filename;
 
 foreach my $file (@files) {
-       local *FH;
        $filename = $file;
-       open(FH, "<$filename") or die "$filename: $!\n";
+
+       open(my $fh, '<', $filename)
+               or die "$filename: $!\n";
        $lineno = 0;
-       while ($line = <FH>) {
+       while ($line = <$fh>) {
                $lineno++;
                &check_include();
                &check_asm_types();
                &check_sizetypes();
-               &check_prototypes();
+               &check_declarations();
                # Dropped for now. Too much noise &check_config();
        }
-       close FH;
+       close $fh;
 }
 exit $ret;
 
@@ -61,10 +62,12 @@ sub check_include
        }
 }
 
-sub check_prototypes
+sub check_declarations
 {
-       if ($line =~ m/^\s*extern\b/) {
-               printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
+       if ($line =~m/^(\s*extern|unsigned|char|short|int|long|void)\b/) {
+               printf STDERR "$filename:$lineno: " .
+                             "userspace cannot reference function or " .
+                             "variable defined in the kernel\n";
        }
 }
 
@@ -76,7 +79,7 @@ sub check_config
 }
 
 my $linux_asm_types;
-sub check_asm_types()
+sub check_asm_types
 {
        if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
                return;