Re: [PATCH] modprobe: add --resolve-alias option

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

 



On Wed, Aug 26, 2009 at 1:37 PM, Thomas Bächler<thomas@xxxxxxxxxxxxx> wrote:
> 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.
> ---
>  doc/modprobe.sgml |    9 +++++++++
>  modprobe.c        |   13 ++++++++++++-
>  2 files changed, 21 insertions(+), 1 deletions(-)
>
> diff --git a/doc/modprobe.sgml b/doc/modprobe.sgml
> index fde8ca7..4f8c5ab 100644
> --- a/doc/modprobe.sgml
> +++ b/doc/modprobe.sgml
> @@ -367,6 +367,15 @@
>         </listitem>
>       </varlistentry>
>       <varlistentry>
> +        <term><option>--resolve-alias</option>
> +        </term>
> +        <listitem>
> +          <para>
> +           Resolve 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..49f389f 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,10 @@ int main(int argc, char *argv[])
>                        flags |= mit_ignore_loaded;
>                        verbose = 1;
>                        break;
> +               case 'R':
> +                       flags |= mit_resolve_alias;
> +                       verbose = 1;
> +                       break;
>                case 'o':
>                        newname = optarg;
>                        break;

Wait... one last comment, switching to printf() should mean you don't
need to set "verbose" here.  That's why I suggested printf(); I didn't
see the point setting "verbose", just so the info() call would show up
- when the info() call is conditional on --resolve-aliases.
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux