* dependency loops
*/
bool visited : 1;
+
+ /*
+ * set by kmod_module_get_probe_list: indicates for probe_insert()
+ * whether the module's command and softdep should be ignored
+ */
+ bool ignorecmd : 1;
};
static inline const char *path_join(const char *path, size_t prefixlen,
}
static int __kmod_module_get_probe_list(struct kmod_module *mod,
+ bool ignorecmd,
struct kmod_list **list);
/* re-entrant */
kmod_list_foreach(l, pre) {
struct kmod_module *m = l->data;
- err = __kmod_module_get_probe_list(m, list);
+ err = __kmod_module_get_probe_list(m, false, list);
if (err < 0)
goto fail;
}
}
*list = l;
mod->visited = true;
+ mod->ignorecmd = (pre != NULL || post != NULL);
kmod_list_foreach(l, post) {
struct kmod_module *m = l->data;
- err = __kmod_module_get_probe_list(m, list);
+ err = __kmod_module_get_probe_list(m, false, list);
if (err < 0)
goto fail;
}
/* re-entrant */
static int __kmod_module_get_probe_list(struct kmod_module *mod,
+ bool ignorecmd,
struct kmod_list **list)
{
struct kmod_list *dep, *l;
}
dep = kmod_module_get_dependencies(mod);
-
- /*
- * Use its softdeps and commands: just put it in the end of the list
- */
- l = kmod_list_append(dep, kmod_module_ref(mod));
- if (l == NULL) {
- kmod_module_unref(mod);
- err = -ENOMEM;
- goto finish;
- }
- dep = l;
-
kmod_list_foreach(l, dep) {
struct kmod_module *m = l->data;
err = __kmod_module_fill_softdep(m, list);
if (err < 0)
- break;
+ goto finish;
}
+ if (ignorecmd) {
+ l = kmod_list_append(*list, kmod_module_ref(mod));
+ if (l == NULL) {
+ kmod_module_unref(mod);
+ err = -ENOMEM;
+ goto finish;
+ }
+ *list = l;
+ mod->ignorecmd = true;
+ } else
+ err = __kmod_module_fill_softdep(mod, list);
+
finish:
kmod_module_unref_list(dep);
return err;
}
static int kmod_module_get_probe_list(struct kmod_module *mod,
+ bool ignorecmd,
struct kmod_list **list)
{
int err;
*/
kmod_set_modules_visited(mod->ctx, false);
- err = __kmod_module_get_probe_list(mod, list);
+ err = __kmod_module_get_probe_list(mod, ignorecmd, list);
if (err < 0) {
kmod_module_unref_list(*list);
*list = NULL;
return err;
}
- err = kmod_module_get_probe_list(mod, &list);
+ err = kmod_module_get_probe_list(mod,
+ !!(flags & KMOD_PROBE_IGNORE_COMMAND), &list);
if (err < 0)
return err;
char *options = module_options_concat(moptions,
m == mod ? extra_options : NULL);
- if (cmd != NULL) {
+ if (cmd != NULL && !m->ignorecmd) {
if (flags & KMOD_PROBE_STOP_ON_COMMAND) {
DBG(mod->ctx, "Stopping on '%s': "
"install command\n", m->name);