[patch 3/5] autoparam: extract script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Domen Puncer <[email protected]>


A simple perl script which extracts parameters, types and
descriptions from binary file.

Signed-off-by: Domen Puncer <[email protected]>

 scripts/kernelparams.pl |   49 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+)

Index: a/scripts/kernelparams.pl
===================================================================
--- /dev/null
+++ a/scripts/kernelparams.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+use strict;
+my ($p, @params, %param_t, %param_d);
+
+while (<>) {
+	my @params = split '\0', $_;
+	foreach $p (@params) {
+		next if (!$p);
+		# module_param, "m:module.param:type"
+		if ($p =~ /^(m:.+?):(.*)/) {
+			$param_t{$1} = " ($2)";
+		}
+		# __setup, "s:"; obsolete_setup; early_param
+		elsif ($p =~ /^([soe]:.+)/) {
+			$param_t{$1} = '';
+		}
+		# description, "d:module.param:description"
+		elsif ($p =~ /^d:(.+?):(.+)/) {
+			$param_d{$1} = $2;
+		}
+		# i.e. ide uses __setup("", blah)
+		elsif ($p !~ /^[soe]:$/) {
+			print STDERR "Parameter error: \"$p\"\n";
+		}
+	}
+}
+
+# print the parameters
+foreach $p (sort(keys(%param_t))) {
+	print "$p$param_t{$p}\n";
+	my $pn = substr($p, 2);
+	if (!$param_d{$pn}) {
+		# only warn for module parameters
+		if ($p =~ "^m:") {
+			print "  No description\n";
+		}
+	} else {
+		print "  $param_d{$pn}\n";
+	}
+	print "\n";
+}
+
+# descriptions alone; typos, deprecated
+foreach $p (sort(keys(%param_d))) {
+	if (!exists $param_t{"m:".$p} && !exists $param_t{"s:".$p} &&
+			!exists $param_t{"o:".$p}) {
+		print STDERR "$p only has description (MODULE_PARM?)\n";
+	}
+}

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux