Re: how to override kernel modules? (patch)

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

 



On Mon, 2004-06-14 at 11:12, Fernando Pablo Lopez-Lezcano wrote:
> On Sun, 2004-06-13 at 19:03, Fernando Pablo Lopez-Lezcano wrote:
> > On Fri, 2004-06-11 at 12:50, Fernando Pablo Lopez-Lezcano wrote:
> > > >From what I have read in the list, FC >= 1 has a /lib/modules/`uname
> > > -r`/updates directory where kernel modules could be dropped to override
> > > modules that are included in the standard kernel. 
> > > 
> > > Apparently that is not happening. The kernel modules in the "updates"
> > > directory are always showing up in modules.dep _after_ the kernel
> > > modules in the main tree. 
> > > 
> > > Anything I need to do to change this?
> > 
> > I did some more code reading and apparently you can't override a kernel
> > module with another module of the same name _reliably_. 
> > [MUNCH]
> > I hope I'm wrong and there's something I did miss. 
> 
> Apparently not. 
> 
> > If my assesment is
> > correct, I'm left with  not options for upgrading the ALSA subsystem
> > independently of the kernel itself. Arghhhh...
> 
> The only one I can think of would be to patch modutils. 

One simple patch attached (just tested it, seems to work) that uses
scandir to reverse-order the directory entries so that, for example,
"_updates/" is scanned first and modules stored there override modules
of the same name that come with the kernel package. 

-- Fernando

--- modutils-2.4.26/module-init-tools-3.0-pre10/depmod.c~	2004-01-22 17:28:17.000000000 -0800
+++ modutils-2.4.26/module-init-tools-3.0-pre10/depmod.c	2004-06-14 13:16:12.637390616 -0700
@@ -464,34 +464,35 @@
 
 static struct module *grab_dir(const char *dirname, struct module *next)
 {
-	DIR *dir;
-	struct dirent *dirent;
+    int n, i;
+	struct dirent **namelist;
 
-	dir = opendir(dirname);
-	if (!dir) {
-		warn("Couldn't open directory %s: %s\n",
-		     dirname, strerror(errno));
-		return next;
+	n = scandir(dirname, &namelist, NULL, alphasort);
+	if (n < 0) {
+	    warn("Couldn't scan directory %s: %s\n",
+		 dirname, strerror(errno));
+	    return next;
 	}
 
-	while ((dirent = readdir(dir)) != NULL) {
-		if (smells_like_module(dirent->d_name))
-			next = grab_module(dirname, dirent->d_name, next);
-		else if (!streq(dirent->d_name, ".")
-			 && !streq(dirent->d_name, "..")) {
+        while (n--) {
+		if (smells_like_module(namelist[n]->d_name))
+			next = grab_module(dirname, namelist[n]->d_name, next);
+		else if (!streq(namelist[n]->d_name, ".")
+			 && !streq(namelist[n]->d_name, "..")) {
 			struct stat st;
 
 			char subdir[strlen(dirname) + 1
-				   + strlen(dirent->d_name) + 1];
-			sprintf(subdir, "%s/%s", dirname, dirent->d_name);
+				   + strlen(namelist[n]->d_name) + 1];
+			sprintf(subdir, "%s/%s", dirname, namelist[n]->d_name);
 			if (lstat(subdir, &st) != 0)
 				warn("Couldn't stat %s: %s\n", subdir,
 				     strerror(errno));
 			else if (S_ISDIR(st.st_mode))
 				next = grab_dir(subdir, next);
 		}
+		free(namelist[n]);
 	}
-	closedir(dir);
+	free(namelist);
 	return next;
 }
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux