]> err.no Git - systemd/commitdiff
libudev: monitor - add event properties to udev_device
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 9 Sep 2008 12:37:36 +0000 (14:37 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 9 Sep 2008 12:37:36 +0000 (14:37 +0200)
README
udev/lib/exported_symbols
udev/lib/libudev-device.c
udev/lib/libudev-monitor.c
udev/lib/libudev-private.h
udev/lib/libudev.h

diff --git a/README b/README
index 2cde586ce23ddcc0ec15cc0b653cf6b7fb18d240..a76583ababfed3434e961a9c8a125b5c1e9e9033 100644 (file)
--- a/README
+++ b/README
@@ -9,7 +9,7 @@ Important Note:
   recommend to replace a distro's udev installation with the upstream version.
 
 Requirements:
-  - Version 2.6.18 of the Linux kernel for reliable operation of this release of
+  - Version 2.6.19 of the Linux kernel for reliable operation of this release of
     udev. The kernel may have a requirement on udev too, see Documentation/Changes
     in the kernel source tree for the actual dependency.
 
index 7b42b28f9f64789def59786ec185aa1c005790aa..620b8964a24ef9980630dc5da4c56402ff633614 100644 (file)
@@ -20,6 +20,7 @@ udev_device_get_properties
 udev_device_get_action
 udev_device_get_driver
 udev_device_get_devnum
+udev_device_get_seqnum
 udev_devices_enumerate
 udev_monitor_new_from_socket
 udev_monitor_enable_receiving
index bec0d69af3edf286baa794eb3ce5b15aecdb7de9..fd7c962d3ace0c10a3e7e6e43ebf65549a73578c 100644 (file)
@@ -47,6 +47,7 @@ struct udev_device {
        char *physdevpath;
        int timeout;
        dev_t devnum;
+       long long int seqnum;
 };
 
 struct udev_device *device_init(struct udev *udev)
@@ -360,6 +361,13 @@ const char *udev_device_get_action(struct udev_device *udev_device)
        return udev_device->action;
 }
 
+unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device)
+{
+       if (udev_device == NULL)
+               return 0;
+       return udev_device->seqnum;
+}
+
 int device_set_devpath(struct udev_device *udev_device, const char *devpath)
 {
        if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0)
@@ -457,6 +465,12 @@ int device_set_timeout(struct udev_device *udev_device, int timeout)
        return 0;
 }
 
+int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum)
+{
+       udev_device->seqnum = seqnum;
+       return 0;
+}
+
 int device_set_devnum(struct udev_device *udev_device, dev_t devnum)
 {
        udev_device->devnum = devnum;
index 5f63d2d4016768ad53e59b12274940396d59e5d2..454a646046451d18f0c1f905abd16f7e8bf02fbd 100644 (file)
@@ -203,6 +203,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
        char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
        char buf[4096];
        size_t bufpos;
+       int maj = 0;
+       int min = 0;
 
        if (udev_monitor == NULL)
                return NULL;
@@ -279,9 +281,26 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                        }
                        if (slink[0] != '\0')
                                device_add_devlink(udev_device, slink);
+               } else if (strncmp(key, "DRIVER=", 7) == 0) {
+                       device_set_driver(udev_device, &key[7]);
+               } else if (strncmp(key, "ACTION=", 7) == 0) {
+                       device_set_action(udev_device, &key[7]);
+               } else if (strncmp(key, "MAJOR=", 6) == 0) {
+                       maj = strtoull(&key[6], NULL, 10);
+               } else if (strncmp(key, "MINOR=", 6) == 0) {
+                       min = strtoull(&key[6], NULL, 10);
+               } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) {
+                       device_set_devpath_old(udev_device, &key[12]);
+               } else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) {
+                       device_set_physdevpath(udev_device, &key[12]);
+               } else if (strncmp(key, "SEQNUM=", 7) == 0) {
+                       device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10));
+               } else if (strncmp(key, "TIMEOUT=", 8) == 0) {
+                       device_set_timeout(udev_device, strtoull(&key[8], NULL, 10));
                }
                device_add_property(udev_device, key);
        }
+       device_set_devnum(udev_device, makedev(maj, min));
 
        return udev_device;
 }
index d8bf981bb5379896fb4ad2810c6f2957f1f6ebbc..d626fe65eef6b0f94f538128624c2c443396d51f 100644 (file)
@@ -69,6 +69,7 @@ extern int device_set_physdevpath(struct udev_device *udev_device, const char *p
 extern int device_get_timeout(struct udev_device *udev_device);
 extern int device_set_timeout(struct udev_device *udev_device, int timeout);
 extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum);
+extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum);
 
 /* udev_ctrl - daemon runtime setup */
 struct udev_ctrl;
index eafd578a557a34e2162d87bcae61960da713a477..58c4ea97bbc002401943b84530382309d9e0927a 100644 (file)
@@ -61,6 +61,7 @@ extern int udev_device_get_properties(struct udev_device *udev_device,
 extern const char *udev_device_get_driver(struct udev_device *udev_device);
 extern dev_t udev_device_get_devnum(struct udev_device *udev_device);
 extern const char *udev_device_get_action(struct udev_device *udev_device);
+extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
 
 extern int udev_devices_enumerate(struct udev *udev, const char *subsystem,
                                  int (*cb)(struct udev *udev,