> a night of sleep and I had a dream in which libkmod had the concept of > "weak dependency". Borrowing the concept from weak symbols, I think it > makes perfect sense... the symbol is there and it may or may not be used > by the linker at the end, but the symbol needs to be there until the > linking phase. At least the parallel makes sense in my head :) Ok, I like your dream :) > Also, I don't think we should mix them with softdep like is done here > after a quick scan through the patch. Ok, understood, and if a new case for softdep is not going to be used, it is clearer: better not mixing with softdep processing. > From man page: > softdep modulename pre: modules... post: modules... > The softdep command allows you to specify soft, or optional, > module dependencies. modulename can be used without these > optional modules installed, but usually with some features > missing. For example, a driver for a storage HBA might > require another module be loaded in order to use management > features. > > pre-deps and post-deps modules are lists of names and/or > aliases of other modules that modprobe will attempt to > install (or remove) in order before and after the main module > given in the modulename argument. > > Example: Assume "softdep c pre: a b post: d e" is provided in > the configuration. Running "modprobe c" is now equivalent to > "modprobe a b c d e" without the softdep. Flags such as > --use-blacklist are applied to all the specified modules, > while module parameters only apply to module c. > > Note: if there are install or remove commands with the same > modulename argument, softdep takes precedence. > > weakdep modulename modules... > The weakdep command allows you to specify weak module > dependecies. Those are similar to pre softdep, with the > difference that userspace doesn't attempt to load that > dependency before the specified module. Instead the kernel > may request one or multiple of them during module probe, > depending on the hardware it's binding to. The purpose of > weak module is to allow a driver to specify that a certain > dependency may be needed, so it should be present in the > filesystem (e.g. in initramfs) when that module is probed. > > Example: Assume "weakdep c a b". A program creating an > initramfs knows it should add a, b, and c to the filesystem > since a and b may be required/desired at runtime. When c is > loaded and is being probed, it may issue calls to > request_module() causing a or b to also be loaded. Ok, thanks for completing this. I will include this in my kmod patch (if it is ok for you). > Also instead of delegating this to the distros, it'd be good if we start > adding those to the ELF section of the modules with > > MODULE_WEAKDEP("..."); > > ... to be defined in the kernel in a similar way that MODULE_SOFTDEP() > is. Agree, better to define in kernel code, that's the reason for the patch. Ok, I will implement in that way and I will create a kernel patch too for this. Indeed (with a different name), it was also in my mind but I didn't dare to create something "new". Thanks for you comments and help Best regards José Ignacio