aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-08-26 19:12:05 +0200
committerJon Masters <jcm@jonmasters.org>2009-10-01 02:00:55 -0400
commitb252b183d4ef7e146367c2ee4a01e00e0cfd016f (patch)
tree8dbbce43a7c44a48ab80d117bc5d3a2cd7ec410c
parentcd02a8eab19e5632bf7ff0594ce743caa6124315 (diff)
downloadmodule-init-tools-b252b183d4ef7e146367c2ee4a01e00e0cfd016f.tar.gz
modprobe: add --resolve-alias option
The --resolve-alias option prints all module names that match the alias given on the commandline and exits. If no valid alias is specified, it does nothing.
-rw-r--r--doc/modprobe.sgml9
-rw-r--r--modprobe.c12
2 files changed, 20 insertions, 1 deletions
diff --git a/doc/modprobe.sgml b/doc/modprobe.sgml
index fde8ca7..69b2d84 100644
--- a/doc/modprobe.sgml
+++ b/doc/modprobe.sgml
@@ -367,6 +367,15 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--resolve-alias</option>
+ </term>
+ <listitem>
+ <para>
+ Print all module names matching an alias.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>-o</option> <option>--name</option>
</term>
<listitem>
diff --git a/modprobe.c b/modprobe.c
index 21a3111..a34709e 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -69,7 +69,8 @@ typedef enum
mit_ignore_commands = 16,
mit_ignore_loaded = 32,
mit_strip_vermagic = 64,
- mit_strip_modversion = 128
+ mit_strip_modversion = 128,
+ mit_resolve_alias = 256
} modprobe_flags_t;
@@ -1335,6 +1336,11 @@ int do_modprobe(char *modname,
}
aliases = apply_blacklist(aliases, blacklist);
+ if(flags & mit_resolve_alias) {
+ for(; aliases; aliases=aliases->next)
+ printf("%s\n", aliases->module);
+ return 0;
+ }
if (aliases) {
errfn_t err = error;
@@ -1373,6 +1379,7 @@ static struct option options[] = { { "version", 0, NULL, 'V' },
{ "show", 0, NULL, 'n' },
{ "dry-run", 0, NULL, 'n' },
{ "show-depends", 0, NULL, 'D' },
+ { "resolve-alias", 0, NULL, 'R' },
{ "dirname", 1, NULL, 'd' },
{ "set-version", 1, NULL, 'S' },
{ "config", 1, NULL, 'C' },
@@ -1453,6 +1460,9 @@ int main(int argc, char *argv[])
flags |= mit_ignore_loaded;
verbose = 1;
break;
+ case 'R':
+ flags |= mit_resolve_alias;
+ break;
case 'o':
newname = optarg;
break;