modprobe: add scanning of /lib/modules/`uname -r`/modules.symbols
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Thu, 16 Aug 2007 10:40:06 +0000 (10:40 +0000)
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Thu, 16 Aug 2007 10:40:06 +0000 (10:40 +0000)
  (by Yann E. MORIN)

git-svn-id: svn://busybox.net/trunk/busybox@19527 69ca8d6d-28ef-0310-b511-8ec308f3f277

modutils/modprobe.c

index 3861dd1..fe399ac 100644 (file)
@@ -504,7 +504,7 @@ static struct dep_t *build_dep(void)
 
        /* Only 2.6 has a modules.alias file */
        if (ENABLE_FEATURE_2_6_MODULES) {
-               /* Parse kernel-declared aliases */
+               /* Parse kernel-declared module aliases */
                filename = xasprintf("/lib/modules/%s/modules.alias", un.release);
                fd = open(filename, O_RDONLY);
                if (fd < 0) {
@@ -518,6 +518,21 @@ static struct dep_t *build_dep(void)
                        include_conf(&first, &current, buffer, sizeof(buffer), fd);
                        close(fd);
                }
+
+               /* Parse kernel-declared symbol aliases */
+               filename = xasprintf("/lib/modules/%s/modules.symbols", un.release);
+               fd = open(filename, O_RDONLY);
+               if (fd < 0) {
+                       /* Ok, that didn't work.  Fall back to looking in /lib/modules */
+                       fd = open("/lib/modules/modules.symbols", O_RDONLY);
+               }
+               if (ENABLE_FEATURE_CLEAN_UP)
+                       free(filename);
+
+               if (fd >= 0) {
+                       include_conf(&first, &current, buffer, sizeof(buffer), fd);
+                       close(fd);
+               }
        }
 
        return first;