Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7485 - in /branches/SuSE-Linux-10_2-Branch/libzypp: VERSION package/libzypp.changes zypp/target/modalias/Modalias.cc
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Fri, 12 Oct 2007 10:39:47 -0000
  • Message-id: <20071012103947.84905451CA@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Oct 12 12:39:47 2007
New Revision: 7485

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7485&view=rev
Log:
SMBIOS DMI modalias matching added

Modified:
    branches/SuSE-Linux-10_2-Branch/libzypp/VERSION
    branches/SuSE-Linux-10_2-Branch/libzypp/package/libzypp.changes
    branches/SuSE-Linux-10_2-Branch/libzypp/zypp/target/modalias/Modalias.cc

Modified: branches/SuSE-Linux-10_2-Branch/libzypp/VERSION
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/libzypp/VERSION?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/libzypp/VERSION (original)
+++ branches/SuSE-Linux-10_2-Branch/libzypp/VERSION Fri Oct 12 12:39:47 2007
@@ -49,5 +49,5 @@
 m4_define([LIBZYPP_MINOR],      [16])
 m4_define([LIBZYPP_COMPATMINOR], [15])
 dnl ==================================================
-m4_define([LIBZYPP_PATCH],      [2])
+m4_define([LIBZYPP_PATCH],      [3])
 dnl ==================================================

Modified: branches/SuSE-Linux-10_2-Branch/libzypp/package/libzypp.changes
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/libzypp/package/libzypp.changes?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/libzypp/package/libzypp.changes (original)
+++ branches/SuSE-Linux-10_2-Branch/libzypp/package/libzypp.changes Fri Oct 12 12:39:47 2007
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Fri Oct 12 12:36:49 CEST 2007 - ma@xxxxxxx
+
+- SMBIOS DMI modalias matching added (#333152)
+- version 2.16.3
+- revision 7485
+
+-------------------------------------------------------------------
 Fri Sep  7 17:42:55 CEST 2007 - jkupec@xxxxxxx
 
 - Require gpg (#308235)

Modified: branches/SuSE-Linux-10_2-Branch/libzypp/zypp/target/modalias/Modalias.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/libzypp/zypp/target/modalias/Modalias.cc?rev=7485&r1=7484&r2=7485&view=diff
==============================================================================
--- branches/SuSE-Linux-10_2-Branch/libzypp/zypp/target/modalias/Modalias.cc (original)
+++ branches/SuSE-Linux-10_2-Branch/libzypp/zypp/target/modalias/Modalias.cc Fri Oct 12 12:39:47 2007
@@ -77,19 +77,17 @@
 };
 
 /*
- * If the device identified by /sys/bus/BUS/devices/DEVICE has a
- * module aliases, remember that alias on the linked modalias list
- * passed in in ARG.
+ * If DIR/FILE/modalias exists, remember this modalias on the linked modalias list
+ * passed in in ARG. Never returns an error.
  */
 static int
-iterate_devices(const char *dir, const char *file, void *arg)
+read_modalias(const char *dir, const char *file, void *arg)
 {
        char path[PATH_MAX];
        int fd;
        ssize_t len;
        char modalias[PATH_MAX];
        struct modalias_list **list = (struct modalias_list **)arg, *entry;
-       int ret = 0;
 
        snprintf(path, sizeof(path), "%s/%s/modalias", dir, file);
        if ((fd = open(path, O_RDONLY)) == -1)
@@ -101,19 +99,16 @@
                len--;
        modalias[len] = 0;
 
-       if ((entry = (struct modalias_list *)malloc(sizeof(*entry))) == NULL) {
-               ret = -1;
+       if ((entry = (struct modalias_list *)malloc(sizeof(*entry))) == NULL)
                goto out;
-       }
        if ((entry->modalias = strdup(modalias)) == NULL) {
-               free(entry);        
-               ret = -1;
+               free(entry);
                goto out;
        }
        entry->next = *list;
        *list = entry;
        XXX << "system modalias: " << entry->modalias << endl;
-       
+
 out:
        (void) close(fd);
        return 0;
@@ -125,12 +120,29 @@
  * the linked modalias list passed in in ARG.
  */
 static int
-iterate_busses(const char *dir, const char *file, void *arg)
+iterate_bus(const char *dir, const char *file, void *arg)
 {
        char path[PATH_MAX];
 
        snprintf(path, sizeof(path), "%s/%s/devices", dir, file);
-       (void) foreach_file(path, iterate_devices, arg);
+       (void) foreach_file(path, read_modalias, arg);
+
+       return 0;
+}
+
+/*
+ * Iterate over all devices in a class (/sys/class/CLASS/<*>)
+ * and remembers all module aliases for those devices on
+ * the linked modalias list passed in in ARG.
+ */
+static int
+iterate_class(const char *dir, const char *file, void *arg)
+{
+       char path[PATH_MAX];
+
+       snprintf(path, sizeof(path), "%s/%s", dir, file);
+       (void) foreach_file(path, read_modalias, arg);
+
        return 0;
 }
 
@@ -147,12 +159,19 @@
     Impl()
        : _modaliases(0)
     {
-       foreach_file( "/sys/bus", iterate_busses, &_modaliases );
+       const char *dir;
        char path[PATH_MAX];
-       const char *dir = getenv("ZYPP_MODALIAS_SYSFS");
-       snprintf(path, sizeof(path), "%s/bus", dir ? dir : "/sys");
-       DBG << "Using /sys path : " << path << endl;
-       foreach_file( path, iterate_busses, &_modaliases );
+
+       dir = getenv("ZYPP_MODALIAS_SYSFS");
+       if (!dir)
+               dir = "/sys";
+       DBG << "Using /sys directory : " << dir << endl;
+
+       snprintf(path, sizeof(path), "%s/bus", dir);
+       foreach_file( path, iterate_bus, &_modaliases );
+
+       snprintf(path, sizeof(path), "%s/class", dir);
+       foreach_file( path, iterate_class, &_modaliases );
     }
 
     /** Dtor. */

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages