[BusyBox] [PATCH] busybox modprobe fixed
Patrick Huesmann
tricknology at gmx.de
Fri May 7 11:23:09 UTC 2004
Hi,
There was some problem with busybox modprobe. For details see
http://www.busybox.net/lists/busybox/2004-May/011507.html
I made a patch against busybox-1.00-pre10 to fix that one.
There is also an attachment in this mail containing the patch, just in case
gmx filters the whitespace and text formatting.
--- modutils/modprobe_orig.c 2004-04-06 14:06:03.000000000 +0200
+++ modutils/modprobe.c 2004-05-05 10:50:29.000000000 +0200
@@ -182,7 +182,7 @@
if (( *(col-2) == '.' ) && ( *(col-1) == 'o' ))
ext = 2;
- mod = bb_xstrndup ( mods, col - mods - ext );
+ mod = bb_xstrndup ( buffer, col - buffer );
if ( !current ) {
first = current = (struct dep_t *) xmalloc ( sizeof ( struct dep_t ));
@@ -354,6 +354,27 @@
return first;
}
+/* check if /lib/modules/bar/foo.ko belongs to module foo */
+/* return 1 = found, 0 = not found */
+static int mod_strcmp ( const char *mod_path, const char *mod_name )
+{
+#if defined(CONFIG_FEATURE_2_6_MODULES)
+ if ( (strstr (mod_path, mod_name) ==
+ (mod_path + strlen(mod_path) - strlen(mod_name) - 3))
+ && (!strcmp(mod_path + strlen(mod_path) - 3, ".ko")) )
+ return 1;
+#endif /* CONFIG_FEATURE_2_6_MODULES */
+
+#if defined(CONFIG_FEATURE_2_4_MODULES)
+ if ( (strstr (mod_path, mod_name) ==
+ (mod_path + strlen(mod_path) - strlen(mod_name) - 2))
+ && (!strcmp(mod_path + strlen(mod_path) - 2, ".o")) )
+ return 1;
+#endif /* CONFIG_FEATURE_2_4_MODULES */
+
+ return 0;
+}
+
/* return 1 = loaded, 0 = not loaded, -1 = can't tell */
static int already_loaded (const char *name)
{
@@ -370,7 +391,7 @@
p = strchr (buffer, ' ');
if (p) {
*p = 0;
- if (strcmp (name, buffer) == 0) {
+ if (mod_strcmp (name, buffer)) {
close (fd);
return 1;
}
@@ -434,7 +455,8 @@
// check dependencies
for ( dt = depend; dt; dt = dt-> m_next ) {
- if ( strcmp ( dt-> m_module, mod ) == 0 ) {
+ if ( mod_strcmp ( dt-> m_module, mod )) {
+ mod = dt-> m_module;
opt = dt-> m_options;
break;
}
Description:
- build_dep() was changed in a way that the full module paths are saved in
dep_t->m_module, not just the module name.
- The new function mod_strcmp() checks if a module path is pointing to a
certain module.
- already_loaded() and check_dep() were altered so that they use
mod_strcmp() instad of strcmp().
Problems:
- I don't know if it works with 2.4 modules, because I only use 2.6 at the
moment. However, I think that it should be no problem.
- I don't know if I broke the modules.conf / alias stuff, because I never
used that stuff in my systems.
Perhaps someone can check this before applying the patch.
Regards,
Patrick
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: modprobe-diff
Type: application/octet-stream
Size: 1743 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20040507/14d5f5eb/attachment.obj
More information about the busybox
mailing list