Message ID | cc43514a0907151104r6208a3dbm89dba496c1411fc0@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Andreas Robinson napsal(a): > Guys, > > is this patch what you need on the m-i-t end? I already have patches here (it's not against Jon's master, but it should apply): http://repo.or.cz/w/mit.git?a=commit;h=45c29de1b54478a63352a3f13c570a964903f54f http://repo.or.cz/w/mit.git?a=commit;h=0e72912a1e0b486225f7052c8d40e28b07ff4495 The idea is that modprobe should just do nothing and exit successfully, so that scripts don't break nor start printing warnings if the kernel config changes. I meant to send it to linux-modules once there is agreement about the modules.builtin file format. Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Jul 15, 2009 at 9:08 PM, Michal Marek<mmarek@suse.cz> wrote: > Andreas Robinson napsal(a): >> Guys, >> >> is this patch what you need on the m-i-t end? > > I already have patches here (it's not against Jon's master, but it > should apply): > http://repo.or.cz/w/mit.git?a=commit;h=45c29de1b54478a63352a3f13c570a964903f54f > http://repo.or.cz/w/mit.git?a=commit;h=0e72912a1e0b486225f7052c8d40e28b07ff4495 Ah, of course! > The idea is that modprobe should just do nothing and exit successfully, > so that scripts don't break nor start printing warnings if the kernel > config changes. I meant to send it to linux-modules once there is > agreement about the modules.builtin file format. Ok, that makes sense. I think there's a small chance of confusion though, when a user tries to insert a module and it doesn't show up with lsmod. Perhaps you can add an info() message? Then the user can figure out what is happening with the --verbose option. Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Andreas Robinson napsal(a): > On Wed, Jul 15, 2009 at 9:08 PM, Michal Marek<mmarek@suse.cz> wrote: >> The idea is that modprobe should just do nothing and exit successfully, >> so that scripts don't break nor start printing warnings if the kernel >> config changes. I meant to send it to linux-modules once there is >> agreement about the modules.builtin file format. > > Ok, that makes sense. > > I think there's a small chance of confusion though, when a user tries > to insert a module and it doesn't show up with lsmod. Perhaps you can > add an info() message? Then the user can figure out what is happening > with the --verbose option. Good idea, will do that. Michal -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From d60a4a56f5d484a6076c606a111510ce40a4ccd8 Mon Sep 17 00:00:00 2001 From: Andreas Robinson <andr345@gmail.com> Date: Wed, 15 Jul 2009 19:48:59 +0200 Subject: [PATCH] modprobe: warn when trying to insert a built-in module The previous behaviour was to fail with "module foo not found". Signed-off-by: Andreas Robinson <andr345@gmail.com> --- modprobe.c | 34 ++++++++++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 2 deletions(-) diff --git a/modprobe.c b/modprobe.c index 21a3111..a0943fe 100644 --- a/modprobe.c +++ b/modprobe.c @@ -1049,6 +1049,29 @@ static char *gather_options(char *argv[]) return optstring; } +/* Check whether a module is built into the kernel */ +static int is_builtin(const char *modname, const char *dirname) +{ + char *filename; + FILE *file; + char *line; + int found = 0; + + nofail_asprintf(&filename, "%s/modules.builtin", dirname); + file = fopen(filename, "r"); + if (file) { + while ((line = getline_wrapped(file, NULL)) != NULL && !found) { + char *p = line; + char *builtin = underscores(strsep_skipspace(&p, "\t ")); + found = streq(modname, builtin); + free(line); + } + fclose(file); + } + free(filename); + return found; +} + /* Do an install/remove command: replace $CMDLINE_OPTS if it's specified. */ static void do_command(const char *modname, const char *command, @@ -1256,6 +1279,7 @@ static int handle_module(const char *modname, struct module_options *modoptions, struct module_command *commands, const char *cmdline_opts, + const char *dirname, errfn_t error, modprobe_flags_t flags) { @@ -1271,6 +1295,11 @@ static int handle_module(const char *modname, return 0; } + if (is_builtin(modname, dirname)) { + warn("Module %s is built into the kernel.\n", modname); + return 0; + } + if (!quiet) error("Module %s not found.\n", modname); return 1; @@ -1350,7 +1379,7 @@ int do_modprobe(char *modname, read_depends(dirname, aliases->module, &list); failed |= handle_module(aliases->module, &list, newname, opts, modoptions, - commands, cmdline_opts, err, flags); + commands, cmdline_opts, dirname, err, flags); aliases = aliases->next; INIT_LIST_HEAD(&list); @@ -1361,7 +1390,8 @@ int do_modprobe(char *modname, return failed; failed |= handle_module(modname, &list, newname, cmdline_opts, - modoptions, commands, cmdline_opts, error, flags); + modoptions, commands, cmdline_opts, dirname, error, + flags); } return failed; } -- 1.6.0.4