rpms/module-init-tools/devel module-init-tools-weak_updates.patch, 1.1, 1.2 module-init-tools.spec, 1.24, 1.25

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Jun 27 17:19:27 UTC 2006


Author: jcm

Update of /cvs/dist/rpms/module-init-tools/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv31804

Modified Files:
	module-init-tools-weak_updates.patch module-init-tools.spec 
Log Message:
Updated the weak-updates patch


module-init-tools-weak_updates.patch:
 depmod.c |  123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 depmod.h |   10 +++++
 2 files changed, 130 insertions(+), 3 deletions(-)

Index: module-init-tools-weak_updates.patch
===================================================================
RCS file: /cvs/dist/rpms/module-init-tools/devel/module-init-tools-weak_updates.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- module-init-tools-weak_updates.patch	14 Jun 2006 12:06:02 -0000	1.1
+++ module-init-tools-weak_updates.patch	27 Jun 2006 17:19:24 -0000	1.2
@@ -1,10 +1,21 @@
---- module-init-tools-3.3-pre1/depmod.c.weak	2006-06-14 12:16:08.000000000 +0200
-+++ module-init-tools-3.3-pre1/depmod.c	2006-06-14 12:16:08.000000000 +0200
-@@ -474,10 +474,26 @@
- 				      const char *filename,
- 				      struct module *next);
+diff -urN module-init-tools-3.3-pre1/depmod.c module-init-tools-3.3-pre1_new/depmod.c
+--- module-init-tools-3.3-pre1/depmod.c	2006-06-27 18:06:37.000000000 +0100
++++ module-init-tools-3.3-pre1_new/depmod.c	2006-06-27 17:44:25.000000000 +0100
+@@ -484,6 +484,27 @@
+ 	return (p[strlen("updates")] == '/' || p[strlen("updates")] == '\0');
+ }
  
-+static int is_weak_update(const char *dirname)
++static int is_extra(const char *dirname)
++{
++	char *p;
++
++	p = strstr(dirname, "extra");
++	if (!p)
++		return 0;
++	return (p[strlen("extra")] == '/' || p[strlen("extra")] == '\0');
++}
++
++static int is_weak(const char *dirname)
 +{
 +	char *p;
 +
@@ -15,19 +26,101 @@
 +		p[strlen("weak-updates")] == '\0');
 +}
 +
- static int is_update(const char *dirname)
+ /* Grab everything not under updates/ directories. */
+ static struct module *do_normal_module(const char *dirname,
+ 				       const char *filename,
+@@ -491,11 +512,12 @@
  {
- 	char *p;
+ 	struct module *new;
  
-+	/* If it's a weak_update then we don't want to match on updates/"
-+         */
-+	if (is_weak_update(dirname))
-+		return 0;
+-	if (is_update(dirname))
++	if (is_update(dirname) || is_extra(dirname) || is_weak(dirname))
+ 		return list;
+ 	new = grab_module(dirname, filename);
+ 	if (!new)
+ 		return list;
++	new->update_type = MODULE_TYPE_NONE; /* not an update */
+ 	new->next = list;
+ 	return new;
+ }
+@@ -518,6 +540,42 @@
+ 	for (i = &list; *i; i = &(*i)->next) {
+ 		if (streq(basename((*i)->pathname), filename)) {
+ 			new->next = (*i)->next;
++			new->update_type = MODULE_TYPE_UPDATE; /* forced */
++			free(*i); /* was leaked */
++			*i = new;
++			return list;
++		}
++	}
++
++	/* Update of non-existent module.  Just prepend. */
++	new->next = list;
++	return new;
++}
++
++/* Grab everything under extra/ directory, override existing in-kernel module
++ * but not if it's already in updates/. */
++
++static struct module *do_extra_module(const char *dirname,
++				      const char *filename,
++				      struct module *list)
++{
++	struct module *new, **i;
++
++	if (!is_extra(dirname))
++		return list;
++
++	new = grab_module(dirname, filename);
++	if (!new)
++		return list;
++
++	/* Find module of same name, and replace it if it's not already an
++	 * update :-) */
++	for (i = &list; *i; i = &(*i)->next) {
++	        if ((streq(basename((*i)->pathname), filename)) &&
++		    !((*i)->update_type&(MODULE_TYPE_UPDATE))) {
++			new->next = (*i)->next;
++		        new->update_type = MODULE_TYPE_EXTRA; /* extra */
++			free(*i);
+ 			*i = new;
+ 			return list;
+ 		}
+@@ -528,6 +586,33 @@
+ 	return new;
+ }
+ 
++static struct module *do_weak_module(const char *dirname,
++				     const char *filename,
++				     struct module *list)
++{
++	struct module *new, **i;
++
++	if (!is_weak(dirname))
++		return list;
++
++	new = grab_module(dirname, filename);
++	if (!new)
++		return list;
 +
- 	p = strstr(dirname, "updates");
- 	if (!p)
- 		return 0;
-@@ -545,8 +561,11 @@
++	/* Make sure we don't already have a module of same name */
++	for (i = &list; *i; i = &(*i)->next) {
++		if (streq(basename((*i)->pathname), filename)) {
++		       free(new);
++		       return list;
++		}
++	}
++
++	/* Module not in the list already. Add it. */
++	new->next = list;
++	new->update_type = MODULE_TYPE_WEAK;
++	return new;
++}
++
+ static struct module *grab_dir(const char *dirname,
+ 			       DIR *dir,
+ 			       struct module *next,
+@@ -545,8 +630,11 @@
  			char subdir[strlen(dirname) + 1
  				   + strlen(dirent->d_name) + 1];
  			sprintf(subdir, "%s/%s", dirname, dirent->d_name);
@@ -37,7 +130,84 @@
 +			 * extra/ to allow for weak-updates symlinks)
 +                         */
 +			if ((readlink(subdir, &dummy, 1) < 0) ||
-+			    is_weak_update(subdir)) {
++			    is_weak(subdir)) {
  				sub = opendir(subdir);
  				if (sub) {
  					next = grab_dir(subdir, sub, next,
+@@ -566,7 +654,19 @@
+ 	DIR *dir;
+ 	struct module *list;
+ 	char updatedir[strlen(dirname) + sizeof("/updates")];
++	char extradir[strlen(dirname) + sizeof("/extra")];
++	char weakdir[strlen(dirname) + sizeof("/weak-updates")];
++
++	/* RHism - we allow updated drivers to be shipped.
++	 * We scan through the available modules as follows:
++	 *
++	 *                           /updates      - overrides everything
++	 *                           /extra        - packaged modules
++	 *                           /             - kernel supplied
++	 *                           /weak-updates - compatible modules
++         */
+ 
++	/* base kernel */
+ 	dir = opendir(dirname);
+ 	if (!dir) {
+ 		warn("Couldn't open directory %s: %s\n",
+@@ -576,12 +676,29 @@
+ 	list = grab_dir(dirname, dir, NULL, do_normal_module);
+ 	closedir(dir);
+ 
++	/* manual updates override everything */
+ 	sprintf(updatedir, "%s/updates", dirname);
+ 	dir = opendir(updatedir);
+ 	if (dir) {
+ 		list = grab_dir(updatedir, dir, list, do_update_module);
+ 		closedir(dir);
+ 	}
++
++	/* extra modules - supplied after the kernel in packaged form. */
++	sprintf(extradir, "%s/extra", dirname);
++	dir = opendir(extradir);
++	if (dir) {
++	        list = grab_dir(extradir, dir, list, do_extra_module);
++		closedir(dir);
++	}
++
++	/* weak-updates last - only add modules not in the kernel tree. */
++	sprintf(weakdir, "%s/weak-updates", dirname);
++	dir = opendir(weakdir);
++	if (dir) {
++	        list = grab_dir(weakdir, dir, list, do_weak_module);
++	        closedir(dir);
++	}
+ 	return list;
+ }
+ 
+diff -urN module-init-tools-3.3-pre1/depmod.h module-init-tools-3.3-pre1_new/depmod.h
+--- module-init-tools-3.3-pre1/depmod.h	2005-12-07 04:51:46.000000000 +0000
++++ module-init-tools-3.3-pre1_new/depmod.h	2006-06-27 17:16:03.000000000 +0100
+@@ -18,6 +18,13 @@
+ /* I hate strcmp. */
+ #define streq(a,b) (strcmp((a),(b)) == 0)
+ 
++enum update_type {
++	MODULE_TYPE_NONE	= 0x00,
++	MODULE_TYPE_UPDATE	= 0x01,
++	MODULE_TYPE_EXTRA	= 0x02,
++	MODULE_TYPE_WEAK	= 0x04,
++};
++
+ struct module
+ {
+ 	/* Next module in list of all modules */
+@@ -29,6 +36,9 @@
+ 	/* Convert endian? */
+ 	int conv;
+ 
++	/* Type of module update? */
++	unsigned int update_type;
++
+ 	/* Dependencies: filled in by ops->calculate_deps() */
+ 	unsigned int num_deps;
+ 	struct module **deps;


Index: module-init-tools.spec
===================================================================
RCS file: /cvs/dist/rpms/module-init-tools/devel/module-init-tools.spec,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- module-init-tools.spec	14 Jun 2006 10:24:01 -0000	1.24
+++ module-init-tools.spec	27 Jun 2006 17:19:24 -0000	1.25
@@ -2,7 +2,7 @@
 Summary: Kernel module management utilities.
 Name: module-init-tools
 Version: 3.3
-Release: 0.pre1.3
+Release: 0.pre1.4
 License: GPL
 Group: System Environment/Kernel
 Source: http://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-%{version}%{preversion}.tar.bz2
@@ -98,6 +98,9 @@
 %ghost %config %verify(not md5 size mtime) /etc/modprobe.conf
 
 %changelog
+* Tue Jun 27 2006 Jon Masters <jcm at redhat.com> - 3.3-0.pre1.4
+- updated patch for weak-modules
+
 * Wed Jun 14 2006 Harald Hoyer <harald at redhat.com> - 3.3-0.pre1.3
 - added patches for weak modules
 




More information about the fedora-cvs-commits mailing list