Update of /cvsroot/leaf/src/bering-uclibc4/source/busybox
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv23126

Added Files:
        modprobe_alias_behaviors.patch 
Log Message:
File added


--- NEW FILE: modprobe_alias_behaviors.patch ---
diff -aur busybox-1.15.3/modutils/Config.in 
busybox-1.15.3.new/modutils/Config.in
--- busybox-1.15.3/modutils/Config.in   2009-12-12 23:13:28.000000000 +0200
+++ busybox-1.15.3.new/modutils/Config.in       2010-07-10 00:34:05.230458203 
+0300
@@ -52,6 +52,31 @@
        help
          Check if the module is already loaded.
 
+choice
+       prompt "Alias loading policy"
+       default FEATURE_MODPROBE_SMALL_LOAD_FIRST_ALIAS
+       depends on MODPROBE_SMALL
+       help
+         Policy for matching modalias: first matched, longest matched
+         modalias, or modalias with longest prefix before wildcard
+
+config FEATURE_MODPROBE_SMALL_LOAD_FIRST_ALIAS
+       bool "First matched"
+       help
+         Load first matched modalias (classical behavior)
+
+config FEATURE_MODPROBE_SMALL_LOAD_LONGEST_ALIAS
+       bool "Longest matched"
+       help
+         Load longest modalias
+
+config FEATURE_MODPROBE_SMALL_LOAD_ALIAS_WITH_LONGEST_PREFIX
+       bool "With longest prefix"
+       help
+         Load modalias that have longest prefix before wildcard
+
+endchoice
+
 config INSMOD
        bool "insmod"
        default n
diff -aur busybox-1.15.3/modutils/modprobe-small.c 
busybox-1.15.3.new/modutils/modprobe-small.c
--- busybox-1.15.3/modutils/modprobe-small.c    2009-12-12 23:13:28.000000000 
+0200
+++ busybox-1.15.3.new/modutils/modprobe-small.c        2010-07-10 
01:27:10.149457190 +0300
@@ -412,6 +412,14 @@
 static module_info* find_alias(const char *alias)
 {
        int i;
+#if ENABLE_FEATURE_MODPROBE_SMALL_LOAD_ALIAS_WITH_LONGEST_PREFIX || 
ENABLE_FEATURE_MODPROBE_SMALL_LOAD_ALIAS_WITH_LONGEST_PREFIX
+       char res_alias[128];
+#endif
+#if ENABLE_FEATURE_MODPROBE_SMALL_LOAD_ALIAS_WITH_LONGEST_PREFIX
+       /* for code speed optimization */
+       char* pos;
+       int pos1, pos2;
+#endif
        int dep_bb_fd;
        module_info *result;
        dbg1_error_msg("find_alias('%s')", alias);
@@ -445,10 +453,12 @@
                if (!modinfo[i].aliases) {
                        parse_module(&modinfo[i], modinfo[i].pathname);
                }
+#if ENABLE_FEATURE_MODPROBE_SMALL_LOAD_FIRST_ALIAS
                if (result) {
                        i++;
                        continue;
                }
+#endif
                /* "alias1 symbol:sym1 alias2 symbol:sym2" */
                desc = str_2_list(modinfo[i].aliases);
                /* Does matching substring exist? */
@@ -460,13 +470,46 @@
                        if (fnmatch(s, alias, 0) == 0) {
                                dbg1_error_msg("found alias '%s' in module 
'%s'",
                                                alias, modinfo[i].pathname);
+#if ENABLE_FEATURE_MODPROBE_SMALL_LOAD_LONGEST_ALIAS
+                               /* Select longest modalias */
+                               if (res_alias == NULL || strlen(res_alias) < 
strlen(s)) {
+                                       strcpy(res_alias, s);
+                                       result = &modinfo[i];
+                                       dbg1_error_msg("using module '%s'",
+                                                        modinfo[i].pathname);
+                               }
+#elif ENABLE_FEATURE_MODPROBE_SMALL_LOAD_ALIAS_WITH_LONGEST_PREFIX
+                               /* Select modalias that have longest prefix 
without '*' */
+                               if (result != NULL) {
+                                       pos = strchr(res_alias, '*');
+                                       if (pos != NULL) {
+                                               pos1 = pos - res_alias;
+                                       } else
+                                               pos1 = strlen(res_alias);
+                                       pos = strchr(s, '*');
+                                       if (pos != NULL) {
+                                               pos2 = pos - s;
+                                       } else
+                                               pos2 = strlen(s);
+                               }
+                               if (result == NULL || pos1 < pos2 ) {
+                                       strcpy(res_alias, s);
+                                       result = &modinfo[i];
+                                       dbg1_error_msg("using module '%s'",
+                                                        modinfo[i].pathname);
+                               }
+#else
+                               /* Classical 'first match' */
                                result = &modinfo[i];
+#endif
                                break;
                        }
                }
                free(desc);
+#if ENABLE_FEATURE_MODPROBE_SMALL_LOAD_FIRST_ALIAS
                if (result && dep_bb_fd < 0)
                        return result;
+#endif
                i++;
        }
 


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
leaf-cvs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to