chiark / gitweb /
udevd: read DRIVER from the environment
authorKay Sievers <kay.sievers@suse.de>
Sun, 13 Aug 2006 03:32:09 +0000 (05:32 +0200)
committerKay Sievers <kay.sievers@suse.de>
Sun, 13 Aug 2006 03:32:09 +0000 (05:32 +0200)
udev.h
udev_sysfs.c
udevd.c
udevd.h

diff --git a/udev.h b/udev.h
index 95a2b88f5ee10266c8d801696dc40cd1f58187f6..be01aeaa2a482019055eedd5ef768750e8880902 100644 (file)
--- a/udev.h
+++ b/udev.h
@@ -109,7 +109,8 @@ extern dev_t udev_device_get_devt(struct udevice *udev);
 extern char sysfs_path[PATH_SIZE];
 extern int sysfs_init(void);
 extern void sysfs_cleanup(void);
 extern char sysfs_path[PATH_SIZE];
 extern int sysfs_init(void);
 extern void sysfs_cleanup(void);
-extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem);
+extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath,
+                                   const char *subsystem, const char *driver);
 extern struct sysfs_device *sysfs_device_get(const char *devpath);
 extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev);
 extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
 extern struct sysfs_device *sysfs_device_get(const char *devpath);
 extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev);
 extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
index ddc0b46790066e30bede2c9bb0026a271633795c..85ea4d15e99b0cc84e4ca68593df9605fbc2dadd 100644 (file)
@@ -79,13 +79,16 @@ void sysfs_cleanup(void)
        }
 }
 
        }
 }
 
-void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem)
+void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath,
+                            const char *subsystem, const char *driver)
 {
        char *pos;
 
        strlcpy(dev->devpath, devpath, sizeof(dev->devpath));
        if (subsystem != NULL)
                strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem));
 {
        char *pos;
 
        strlcpy(dev->devpath, devpath, sizeof(dev->devpath));
        if (subsystem != NULL)
                strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem));
+       if (driver != NULL)
+               strlcpy(dev->driver, driver, sizeof(dev->driver));
 
        /* set kernel name */
        pos = strrchr(dev->devpath, '/');
 
        /* set kernel name */
        pos = strrchr(dev->devpath, '/');
@@ -181,7 +184,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath)
                return NULL;
        memset(dev, 0x00, sizeof(struct sysfs_device));
 
                return NULL;
        memset(dev, 0x00, sizeof(struct sysfs_device));
 
-       sysfs_device_set_values(dev, devpath_real, NULL);
+       sysfs_device_set_values(dev, devpath_real, NULL, NULL);
 
        /* get subsystem */
        if (strncmp(dev->devpath, "/class/", 7) == 0) {
 
        /* get subsystem */
        if (strncmp(dev->devpath, "/class/", 7) == 0) {
diff --git a/udevd.c b/udevd.c
index af9e118c55061146b4952f416b8fb9385c534386..f4f918900a026a5a40c25c83ce395d3891a84f30 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -118,7 +118,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg)
        if (udev == NULL)
                return -1;
        strlcpy(udev->action, msg->action, sizeof(udev->action));
        if (udev == NULL)
                return -1;
        strlcpy(udev->action, msg->action, sizeof(udev->action));
-       sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem);
+       sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver);
        udev->devt = msg->devt;
 
        retval = udev_device_event(&rules, udev);
        udev->devt = msg->devt;
 
        retval = udev_device_event(&rules, udev);
@@ -593,6 +593,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz
                        msg->devpath = &key[8];
                else if (strncmp(key, "SUBSYSTEM=", 10) == 0)
                        msg->subsystem = &key[10];
                        msg->devpath = &key[8];
                else if (strncmp(key, "SUBSYSTEM=", 10) == 0)
                        msg->subsystem = &key[10];
+               else if (strncmp(key, "DRIVER=", 7) == 0)
+                       msg->driver = &key[7];
                else if (strncmp(key, "SEQNUM=", 7) == 0)
                        msg->seqnum = strtoull(&key[7], NULL, 10);
                else if (strncmp(key, "PHYSDEVPATH=", 12) == 0)
                else if (strncmp(key, "SEQNUM=", 7) == 0)
                        msg->seqnum = strtoull(&key[7], NULL, 10);
                else if (strncmp(key, "PHYSDEVPATH=", 12) == 0)
diff --git a/udevd.h b/udevd.h
index 688e6d52ef19d817ba384dd340c4339e57bd3151..c1f0fd6a1263b55d7bf66b2f71695d70ff2eb06a 100644 (file)
--- a/udevd.h
+++ b/udevd.h
@@ -64,6 +64,7 @@ struct udevd_uevent_msg {
        char *action;
        char *devpath;
        char *subsystem;
        char *action;
        char *devpath;
        char *subsystem;
+       char *driver;
        dev_t devt;
        unsigned long long seqnum;
        char *physdevpath;
        dev_t devt;
        unsigned long long seqnum;
        char *physdevpath;