Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
module-init-tools
depmod-use-modules.order.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File depmod-use-modules.order.patch of Package module-init-tools
From: Tejun Heo <htejun@gmail.com> Kbuild now generates and installs modules.order along with modules. This patch updates depmod such that it sorts module list according to the file before generating output files. Modules which aren't on modules.order are put after modules which are ordered by modules.order. This makes modprobe to prioritize modules according to kernel Makefile's just as built-in modules are link-ordered by them. --- depmod.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) --- depmod.c.orig +++ depmod.c @@ -682,6 +682,54 @@ static struct module *grab_basedir(const return list; } +static void sort_modules(const char *dirname, struct module **listp) +{ + struct module *list = *listp, *tlist = NULL, **tpos = &tlist; + FILE *modorder; + int dir_len = strlen(dirname) + 1; + char file_name[dir_len + strlen("modules.order") + 1]; + char line[10240]; + + sprintf(file_name, "%s/%s", dirname, "modules.order"); + + modorder = fopen(file_name, "r"); + if (!modorder) { + /* Older kernels don't generate modules.order. Just + return if the file doesn't exist. */ + if (errno == ENOENT) + return; + fatal("Could not open '%s': %s\n", file_name, strerror(errno)); + } + + sprintf(line, "%s/", dirname); + + /* move modules listed in modorder file to tlist in order */ + while (fgets(line, sizeof(line), modorder)) { + struct module **pos, *mod; + int len = strlen(line); + + if (line[len - 1] == '\n') + line[len - 1] = '\0'; + + for (pos = &list; (mod = *pos); pos = &(*pos)->next) { + if (strcmp(line, mod->pathname + dir_len) == 0) { + *pos = mod->next; + mod->next = NULL; + *tpos = mod; + tpos = &mod->next; + break; + } + } + } + + /* append the rest */ + *tpos = list; + + fclose(modorder); + + *listp = tlist; +} + static void parse_modules(struct module *list) { struct module *i; @@ -1184,6 +1232,7 @@ int main(int argc, char *argv[]) } else { list = grab_basedir(dirname,search,overrides); } + sort_modules(dirname, &list); parse_modules(list); for (i = 0; i < sizeof(depfiles)/sizeof(depfiles[0]); i++) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor