diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-20 17:36:18 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-07-20 17:36:18 +0000 |
commit | ad4e1be1af5782b8bb05461788848fa2c4c7d2ca (patch) | |
tree | 6d69dc49042d622e2a1b9b7ea70576d9853b004d | |
parent | 2e622fbfe9ff6bf33d09b79df754b6b9c6cd1f7a (diff) | |
download | busybox-w32-ad4e1be1af5782b8bb05461788848fa2c4c7d2ca.tar.gz busybox-w32-ad4e1be1af5782b8bb05461788848fa2c4c7d2ca.tar.bz2 busybox-w32-ad4e1be1af5782b8bb05461788848fa2c4c7d2ca.zip |
Patch from Yann Morin to fix bug 941, underscores in module aliases.
git-svn-id: svn://busybox.net/trunk/busybox@15734 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | modutils/Config.in | 13 | ||||
-rw-r--r-- | modutils/modprobe.c | 35 |
2 files changed, 45 insertions, 3 deletions
diff --git a/modutils/Config.in b/modutils/Config.in index cf46b0863..8974fb795 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
@@ -91,7 +91,8 @@ config CONFIG_MODPROBE | |||
91 | module options from the configuration file. See option below. | 91 | module options from the configuration file. See option below. |
92 | 92 | ||
93 | config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | 93 | config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS |
94 | bool "Multiple options parsing" | 94 | bool |
95 | prompt "Multiple options parsing" if CONFIG_NITPICK | ||
95 | default y | 96 | default y |
96 | depends on CONFIG_MODPROBE | 97 | depends on CONFIG_MODPROBE |
97 | help | 98 | help |
@@ -106,6 +107,16 @@ config CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS | |||
106 | Saying Y here is not a bad idea if you're not that short | 107 | Saying Y here is not a bad idea if you're not that short |
107 | on storage capacity. | 108 | on storage capacity. |
108 | 109 | ||
110 | config CONFIG_FEATURE_MODPROBE_FANCY_ALIAS | ||
111 | bool | ||
112 | prompt "Fancy alias parsing" if CONFIG_NITPICK | ||
113 | default y | ||
114 | depends on CONFIG_MODPROBE && CONFIG_FEATURE_2_6_MODULES | ||
115 | help | ||
116 | Say 'y' here to enable parsing of aliases with underscore/dash | ||
117 | mismatch between module name and file name, along with bus-specific | ||
118 | aliases (such as pci:... or usb:... aliases). | ||
119 | |||
109 | comment "Options common to multiple modutils" | 120 | comment "Options common to multiple modutils" |
110 | depends on CONFIG_INSMOD || CONFIG_RMMOD || CONFIG_MODPROBE || CONFIG_LSMOD | 121 | depends on CONFIG_INSMOD || CONFIG_RMMOD || CONFIG_MODPROBE || CONFIG_LSMOD |
111 | 122 | ||
diff --git a/modutils/modprobe.c b/modutils/modprobe.c index a04377180..b11e58d55 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c | |||
@@ -713,6 +713,37 @@ static int mod_process ( struct mod_list_t *list, int do_insert ) | |||
713 | } | 713 | } |
714 | 714 | ||
715 | /* | 715 | /* |
716 | * Check the matching between a pattern and a module name. | ||
717 | * We need this as *_* is equivalent to *-*, even in pattern matching. | ||
718 | */ | ||
719 | static int check_pattern( const char* pat_src, const char* mod_src ) { | ||
720 | int ret; | ||
721 | |||
722 | if (ENABLE_FEATURE_MODPROBE_FANCY_ALIAS) { | ||
723 | char* pat; | ||
724 | char* mod; | ||
725 | char* p; | ||
726 | |||
727 | pat = bb_xstrdup (pat_src); | ||
728 | mod = bb_xstrdup (mod_src); | ||
729 | |||
730 | for (p = pat; (p = strchr(p, '-')); *p++ = '_' ); | ||
731 | for (p = mod; (p = strchr(p, '-')); *p++ = '_' ); | ||
732 | |||
733 | ret = fnmatch ( pat, mod, 0 ); | ||
734 | |||
735 | if (ENABLE_FEATURE_CLEAN_UP) { | ||
736 | free (pat); | ||
737 | free (mod); | ||
738 | } | ||
739 | |||
740 | return ret; | ||
741 | } else { | ||
742 | return fnmatch ( pat_src, mod_src, 0 ); | ||
743 | } | ||
744 | } | ||
745 | |||
746 | /* | ||
716 | * Builds the dependency list (aka stack) of a module. | 747 | * Builds the dependency list (aka stack) of a module. |
717 | * head: the highest module in the stack (last to insmod, first to rmmod) | 748 | * head: the highest module in the stack (last to insmod, first to rmmod) |
718 | * tail: the lowest module in the stack (first to insmod, last to rmmod) | 749 | * tail: the lowest module in the stack (first to insmod, last to rmmod) |
@@ -730,7 +761,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |||
730 | * Of course if the name in the dependency rule is a plain string, | 761 | * Of course if the name in the dependency rule is a plain string, |
731 | * then we consider it a pattern, and matching will still work. */ | 762 | * then we consider it a pattern, and matching will still work. */ |
732 | for ( dt = depend; dt; dt = dt-> m_next ) { | 763 | for ( dt = depend; dt; dt = dt-> m_next ) { |
733 | if ( fnmatch ( dt-> m_name, mod, 0 ) == 0) { | 764 | if ( check_pattern ( dt-> m_name, mod ) == 0) { |
734 | break; | 765 | break; |
735 | } | 766 | } |
736 | } | 767 | } |
@@ -746,7 +777,7 @@ static void check_dep ( char *mod, struct mod_list_t **head, struct mod_list_t * | |||
746 | struct dep_t *adt; | 777 | struct dep_t *adt; |
747 | 778 | ||
748 | for ( adt = depend; adt; adt = adt-> m_next ) { | 779 | for ( adt = depend; adt; adt = adt-> m_next ) { |
749 | if ( strcmp ( adt-> m_name, dt-> m_deparr [0] ) == 0 ) | 780 | if ( check_pattern ( adt-> m_name, dt-> m_deparr [0] ) == 0 ) |
750 | break; | 781 | break; |
751 | } | 782 | } |
752 | if ( adt ) { | 783 | if ( adt ) { |