diff options
Diffstat (limited to 'command-list.c')
-rw-r--r-- | command-list.c | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/command-list.c b/command-list.c index d65440c..7dc5933 100644 --- a/command-list.c +++ b/command-list.c @@ -43,13 +43,12 @@ #include "files.h" #include "kernel.h" #include "manifest.h" +#include "conflicting-kernel-modules.h" static void free_file_list(FileList* l); -static void find_conflicting_kernel_modules(Options *op, - Package *p, - FileList *l); +static void find_conflicting_kernel_modules(Options *op, FileList *l); static void find_existing_files(Package *p, FileList *l, PackageEntryFileTypeList *file_type_list); @@ -207,8 +206,9 @@ CommandList *build_command_list(Options *op, Package *p) /* find any possibly conflicting modules and/or libraries */ - if (!op->no_kernel_module || op->dkms) - find_conflicting_kernel_modules(op, p, l); + if (!op->no_kernel_module || op->dkms) { + find_conflicting_kernel_modules(op, l); + } /* check the conflicting file list for any installed kernel modules */ @@ -377,14 +377,6 @@ CommandList *build_command_list(Options *op, Package *p) } } - /* find any commands we should run */ - - for (i = 0; i < p->num_entries; i++) { - if (p->entries[i].type == FILE_TYPE_KERNEL_MODULE_CMD) { - add_command(c, RUN_CMD, p->entries[i].file, NULL, 0); - } - } - /* * if "--no-abi-note" was requested, scan for any OpenGL * libraries, and run the following command on them: @@ -625,13 +617,13 @@ int execute_command_list(Options *op, CommandList *c, * modules under the kernel module installation prefix. */ -static void find_conflicting_kernel_modules(Options *op, - Package *p, FileList *l) +static void find_conflicting_kernel_modules(Options *op, FileList *l) { - int i = 0, n = 0; - ConflictingFileInfo files[2]; + int i = 0; + ConflictingFileInfo *files; char *paths[3]; char *tmp = get_kernel_name(op); + char **filenames; /* Don't descend into the "build" or "source" directories; these won't * contain modules, and may be symlinks back to an actual source tree. */ @@ -641,9 +633,6 @@ static void find_conflicting_kernel_modules(Options *op, { 0, NULL } }; - memset(files, 0, sizeof(files)); - files[1].name = NULL; - files[1].len = 0; if (op->kernel_module_installation_path) { paths[i++] = op->kernel_module_installation_path; } @@ -653,18 +642,25 @@ static void find_conflicting_kernel_modules(Options *op, } paths[i] = NULL; - + + /* Build the list of conflicting kernel modules */ + + files = nvalloc((num_conflicting_kernel_modules + 1) * sizeof(files[0])); + filenames = nvalloc(num_conflicting_kernel_modules * sizeof(filenames[0])); + + for (i = 0; i < num_conflicting_kernel_modules; i++) { + filenames[i] = nvstrcat(conflicting_kernel_modules[i], ".ko", NULL); + files[i].name = filenames[i]; + files[i].len = strlen(filenames[i]); + } + for (i = 0; paths[i]; i++) { - for (n = 0; p->bad_module_filenames[n]; n++) { - /* - * Recursively search for this conflicting kernel module - * relative to the current prefix. - */ - files[0].name = p->bad_module_filenames[n]; - files[0].len = strlen(files[0].name); + /* + * Recursively search for the conflicting kernel modules + * relative to the current prefix. + */ - find_conflicting_files(op, paths[i], files, l, skipdirs); - } + find_conflicting_files(op, paths[i], files, l, skipdirs); } /* free any paths we nvstrcat()'d above */ @@ -673,7 +669,14 @@ static void find_conflicting_kernel_modules(Options *op, nvfree(paths[i]); } -} /* find_conflicting_kernel_modules() */ + /* free the kernel module names */ + + for (i = 0; i < num_conflicting_kernel_modules; i++) { + nvfree(filenames[i]); + } + nvfree(filenames); + nvfree(files); +} |