|
Harald Hoyer |
02dec6 |
From c38f9e980c1ee03151dd1c6602907c6228b78d30 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
02dec6 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
02dec6 |
Date: Tue, 4 Dec 2018 10:02:45 +0100
|
|
Harald Hoyer |
02dec6 |
Subject: [PATCH] install/dracut-install.c: install module dependencies of
|
|
Harald Hoyer |
02dec6 |
dependencies
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
---
|
|
Harald Hoyer |
02dec6 |
install/dracut-install.c | 28 +++++++++++++++++++++++++---
|
|
Harald Hoyer |
02dec6 |
1 file changed, 25 insertions(+), 3 deletions(-)
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
diff --git a/install/dracut-install.c b/install/dracut-install.c
|
|
Harald Hoyer |
02dec6 |
index 5f352b36..d64de545 100644
|
|
Harald Hoyer |
02dec6 |
--- a/install/dracut-install.c
|
|
Harald Hoyer |
02dec6 |
+++ b/install/dracut-install.c
|
|
Harald Hoyer |
02dec6 |
@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
|
|
Harald Hoyer |
02dec6 |
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
+static inline void kmod_module_unrefp(struct kmod_module **p) {
|
|
Harald Hoyer |
02dec6 |
+ if (*p)
|
|
Harald Hoyer |
02dec6 |
+ kmod_module_unref(*p);
|
|
Harald Hoyer |
02dec6 |
+}
|
|
Harald Hoyer |
02dec6 |
+#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
static inline void kmod_module_unref_listp(struct kmod_list **p) {
|
|
Harald Hoyer |
02dec6 |
if (*p)
|
|
Harald Hoyer |
02dec6 |
@@ -1230,28 +1235,45 @@ static bool check_module_path(const char *path)
|
|
Harald Hoyer |
02dec6 |
static int install_dependent_modules(struct kmod_list *modlist)
|
|
Harald Hoyer |
02dec6 |
{
|
|
Harald Hoyer |
02dec6 |
struct kmod_list *itr;
|
|
Harald Hoyer |
02dec6 |
- struct kmod_module *mod;
|
|
Harald Hoyer |
02dec6 |
const char *path = NULL;
|
|
Harald Hoyer |
02dec6 |
const char *name = NULL;
|
|
Harald Hoyer |
02dec6 |
int ret = 0;
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
kmod_list_foreach(itr, modlist) {
|
|
Harald Hoyer |
02dec6 |
+ _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
|
|
Harald Hoyer |
02dec6 |
mod = kmod_module_get_module(itr);
|
|
Harald Hoyer |
02dec6 |
path = kmod_module_get_path(mod);
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
+ if (check_hashmap(items_failed, path))
|
|
Harald Hoyer |
02dec6 |
+ return -1;
|
|
Harald Hoyer |
02dec6 |
+
|
|
Harald Hoyer |
02dec6 |
+ if (check_hashmap(items, path)) {
|
|
Harald Hoyer |
02dec6 |
+ continue;
|
|
Harald Hoyer |
02dec6 |
+ }
|
|
Harald Hoyer |
02dec6 |
+
|
|
Harald Hoyer |
02dec6 |
name = kmod_module_get_name(mod);
|
|
Harald Hoyer |
02dec6 |
+
|
|
Harald Hoyer |
02dec6 |
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
|
|
Harald Hoyer |
02dec6 |
- kmod_module_unref(mod);
|
|
Harald Hoyer |
02dec6 |
continue;
|
|
Harald Hoyer |
02dec6 |
}
|
|
Harald Hoyer |
02dec6 |
+
|
|
Harald Hoyer |
02dec6 |
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
|
Harald Hoyer |
02dec6 |
if (ret == 0) {
|
|
Harald Hoyer |
02dec6 |
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
|
Harald Hoyer |
02dec6 |
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
|
Harald Hoyer |
02dec6 |
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
|
Harald Hoyer |
02dec6 |
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
|
Harald Hoyer |
02dec6 |
install_firmware(mod);
|
|
Harald Hoyer |
02dec6 |
+ modlist = kmod_module_get_dependencies(mod);
|
|
Harald Hoyer |
02dec6 |
+ ret = install_dependent_modules(modlist);
|
|
Harald Hoyer |
02dec6 |
+ if (ret == 0) {
|
|
Harald Hoyer |
02dec6 |
+ ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
|
|
Harald Hoyer |
02dec6 |
+ if (ret == 0)
|
|
Harald Hoyer |
02dec6 |
+ ret = install_dependent_modules(modpre);
|
|
Harald Hoyer |
02dec6 |
+ }
|
|
Harald Hoyer |
02dec6 |
} else {
|
|
Harald Hoyer |
02dec6 |
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
|
Harald Hoyer |
02dec6 |
}
|
|
Harald Hoyer |
02dec6 |
- kmod_module_unref(mod);
|
|
Harald Hoyer |
02dec6 |
}
|
|
Harald Hoyer |
02dec6 |
|
|
Harald Hoyer |
02dec6 |
return ret;
|
|
Harald Hoyer |
02dec6 |
|