[PATCH] Added mechanism for per-kernel version module options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Often module parameters change or are moved into a different module.
For example, for kernel versions 2.6.39+, the bluetooth 'sco' protocol
module code was moved into the 'bluetooth' module. The 'sco' module
parameter, disable_esco, was moved into the 'bluetooth' module as well.
Consequently, it is not possible to have an
  'options bluetooth disable_esco=Y'
in /etc/modprobe.d/*.conf files without causing a module load failure
in pre-2.6.39 kernels.

This patch adds a scan for *.conf files in the directory
  /etc/modprobe.d/`uname -r`

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---
 modprobe.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modprobe.c b/modprobe.c
index 5464f45..3e6e660 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -1409,8 +1409,11 @@ static int parse_config_scan(struct modprobe_conf *conf,
 static void parse_toplevel_config(const char *filename,
 				  struct modprobe_conf *conf,
 				  int dump_only,
-				  int removing)
+				  int removing,
+				  struct utsname *buf)
 {
+	char *dirname;
+
 	if (filename) {
 		if (!parse_config_scan(conf, dump_only, removing, filename,
 				       NULL))
@@ -1425,10 +1428,14 @@ static void parse_toplevel_config(const char *filename,
 		warn("Deprecated config file /etc/modprobe.conf, "
 		      "all config files belong into /etc/modprobe.d/.\n");
 
+	/* also scan in /etc/modprobe.d/`utsname -r` */
+	nofail_asprintf(&dirname, "/etc/modprobe.d/%s", buf->release);
+
 	/* default config */
 	parse_config_scan(conf, dump_only, removing, "/run/modprobe.d",
 			  "/etc/modprobe.d", "/usr/local/lib/modprobe.d",
-			  "/lib/modprobe.d", NULL);
+			  "/lib/modprobe.d", dirname, NULL);
+	free(dirname);
 }
 
 /**
@@ -2252,7 +2259,7 @@ int main(int argc, char *argv[])
 	}
 
 	/* Read aliases, options etc. */
-	parse_toplevel_config(configname, &conf, dump_config, flags & mit_remove);
+	parse_toplevel_config(configname, &conf, dump_config, flags & mit_remove, &buf);
 
 	/* Read module options from kernel command line */
 	parse_kcmdline(dump_config, &conf);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux