modprobe priorities for module loading in cause when there are 2 or more corresponding modules

Denys Vlasenko vda.linux at googlemail.com
Wed Aug 11 15:21:33 UTC 2010


Hi Andrew,

On Sunday 08 August 2010 00:17, Andrew wrote:
> Hi all.
> I added patch that allows to add criterias for best module matching in 
> modprobe. I attached it to bug #627 - but nobody from developers 
> comments it.
> This patch is a good solution for me (I use 'Longest matching prefix 
> before wildcard' criteria), and I think that it'll be a good solution 
> for many people who have same trouble.

Well, the solution needed here is to closely follow module-init-tools.

There is a comment in modprobe_small.c about the exact nature
of the problem:

/*
 * Given modules definition and module name (or alias, or symbol)
 * load/remove the module respecting dependencies.
 * NB: also called by depmod with bogus name "/",
 * just in order to force modprobe.dep.bb creation.
*/
static void process_module(char *name, const char *cmdline_options)
{
        module_info *info;
...
...

        if (!module_count) {
                /* Scan module directory. This is done only once.
                 * It will attempt module load, and will exit(EXIT_SUCCESS)
                 * on success. */
...
                dbg1_error_msg("dirscan complete");
                /* Module was not found, or load failed, or is_rmmod */
                if (module_found_idx >= 0) { /* module was found */
                        info = &modinfo[module_found_idx];
                } else { /* search for alias, not a plain module name */
                        info = find_alias(name);
                }
        } else {
                info = find_alias(name);
        }

// Problem here: there can be more than one module
// for the given alias. For example,
// "pci:v00008086d00007010sv00000000sd00000000bc01sc01i80" matches
// ata_piix because it has an alias "pci:v00008086d00007010sv*sd*bc*sc*i*"
// and ata_generic, it has an alias "alias=pci:v*d*sv*sd*bc01sc01i*"
// Standard modprobe would load them both.
// In this code, find_alias() returns only the first matching module.


That's where the problem is: find_alias() returns one module_info;
but in order to mimic module-init-tools, it needs to return
*a list* of matching module_info's.

-- 
vda


More information about the busybox mailing list