summaryrefslogtreecommitdiff
path: root/kernel/xpp/param_doc
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-02-04 23:00:48 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-02-04 23:00:48 +0000
commit7e068801fbf82413ac0a5e63e586c268bd457434 (patch)
tree9b61e9a4e07167e0b7d347e4336245724befa29c /kernel/xpp/param_doc
parent29daeebad888269fa0ee2ca7e54e238c8498ca2d (diff)
Move kernel stuff to under kernel/
(merged branch /zaptel/team/tzafrir/move ) Closes issue #7117. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3793 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/param_doc')
-rwxr-xr-xkernel/xpp/param_doc40
1 files changed, 40 insertions, 0 deletions
diff --git a/kernel/xpp/param_doc b/kernel/xpp/param_doc
new file mode 100755
index 0000000..5848728
--- /dev/null
+++ b/kernel/xpp/param_doc
@@ -0,0 +1,40 @@
+#! /usr/bin/perl -w
+use strict;
+#
+# Extract parameter documentation from *.ko files.
+# Assumes that parameter description include the default
+# value in the format we use in our DEF_PARM() macro
+#
+
+@ARGV || die "Usage: $0 module.ko....\n";
+
+my $modinfo = '/sbin/modinfo';
+my @mod_params;
+
+foreach my $file (glob "@ARGV") {
+ undef @mod_params;
+ print "$file:\n";
+ open(F, "$modinfo '$file' |") || die;
+ while(<F>) {
+ chomp;
+ next unless s/^parm:\s*//;
+ my ($name, $description) = split(/:/, $_, 2);
+ # Extract type
+ $description =~ s/\s*\(([^)]+)\)$//;
+ my $type = $1;
+ # Extract default value
+ $description =~ s/\s*\[default\s+([^]]+)\]$//;
+ my $default = $1;
+ push(@mod_params, {
+ NAME => $name,
+ TYPE => $type,
+ DEFVAL => $default,
+ DESC => $description,
+ });
+ }
+ # Print sorted list
+ foreach my $p (sort { $a->{NAME} cmp $b->{NAME} } @mod_params) {
+ printf "\t%-8s %-22s = %-20s %s\n", $p->{TYPE}, $p->{NAME}, $p->{DEFVAL}, $p->{DESC};
+ }
+ close F || die;
+}