diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2008-05-21 15:11:48 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2008-05-21 15:11:48 +0000 |
commit | 802b567e6c7ba7803a950324cbed13f7d57944cb (patch) | |
tree | 6b90ca3119aaa2e4073d3b651ac965dea5d3430e /drivers/dahdi/xpp/param_doc | |
parent | ec5ce88e015b41c2f46f6c9b783339b945f9502a (diff) |
start copying kernel bits
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4315 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/xpp/param_doc')
-rwxr-xr-x | drivers/dahdi/xpp/param_doc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/dahdi/xpp/param_doc b/drivers/dahdi/xpp/param_doc new file mode 100755 index 0000000..5848728 --- /dev/null +++ b/drivers/dahdi/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; +} |