mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.de.marchi@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Lucas De Marchi <lucas.de.marchi@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 3/3] init/Kconfig: Add option to set modprobe command
Date: Fri, 10 May 2013 01:15:16 -0300	[thread overview]
Message-ID: <1368159316-31744-3-git-send-email-lucas.de.marchi@gmail.com> (raw)
In-Reply-To: <1368159316-31744-1-git-send-email-lucas.de.marchi@gmail.com>

The hard-coded path of modprobe doesn't allow distros to put the binary
in another place without add links from one place to another. For
example, in recent versions of distros like Fedora, Arch and Suse, kmod
is the default tool to load modules and they have to create a link from
modprobe to kmod binary.  kmod relies on argv[0] to know what to do but
in future they want to add commands like "kmod load -- modulename",
which is not possible if the path to the tool to load modules is
hard-coded in kernel.

Moreover, it's already possible to set the path through /proc/sys, but
it would have to be done very early in the boot sequence and on every
boot since modprobe may be called even before / is mounted. In this
scenario booting without and initrd would be more difficult as well.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
---
 init/Kconfig  | 7 +++++++
 kernel/kmod.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 5341d72..72eee1c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1593,6 +1593,13 @@ menuconfig MODULES
 
 if MODULES
 
+config DEFAULT_MODULE_LOAD_BIN
+	string "Default module load binary"
+	default "/sbin/modprobe -q --"
+	help
+	  This option determines the default executable to be called when a
+	  module is requested to be loaded via request_module().
+
 config MODULE_FORCE_LOAD
 	bool "Forced module loading"
 	default n
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 70df90b..1828542 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -67,7 +67,7 @@ static DECLARE_RWSEM(umhelper_sem);
 /*
 	modprobe_path is set via /proc/sys.
 */
-char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe -q --";
+char modprobe_path[KMOD_PATH_LEN] = CONFIG_DEFAULT_MODULE_LOAD_BIN;
 
 static void free_modprobe_argv(struct subprocess_info *info)
 {
-- 
1.8.2.2


  parent reply	other threads:[~2013-05-10  4:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10  4:15 [PATCH 1/3] argv_split(): Allow extra params Lucas De Marchi
2013-05-10  4:15 ` [PATCH 2/3] kmod: Use argv_split(), passing module as extra param Lucas De Marchi
2013-05-10  4:15 ` Lucas De Marchi [this message]
2013-05-10 12:58   ` [PATCH 3/3] init/Kconfig: Add option to set modprobe command Oleg Nesterov
2013-05-10 13:12     ` Oleg Nesterov
2013-05-10 13:15     ` Lucas De Marchi
2013-05-10 15:36       ` Oleg Nesterov
2013-05-10 16:03         ` Lucas De Marchi
2013-05-10 17:10           ` Oleg Nesterov
2013-05-10 17:35             ` Oleg Nesterov
2013-05-10 17:44               ` Lucas De Marchi
2013-05-13 13:59                 ` Oleg Nesterov
2013-05-11 20:10             ` Lucas De Marchi
2013-05-13 14:16               ` Oleg Nesterov
2013-05-13 14:35                 ` [RFC] teach argv_split() to ignore the spaces surrounded by \e Oleg Nesterov
2013-05-13 16:06                   ` Colin Walters
2013-05-13 17:13                     ` Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368159316-31744-3-git-send-email-lucas.de.marchi@gmail.com \
    --to=lucas.de.marchi@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®