]> err.no Git - systemd/commitdiff
libudev: device - add get_parent_with_subsystem()
authorKay Sievers <kay.sievers@vrfy.org>
Thu, 2 Oct 2008 19:19:00 +0000 (21:19 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Thu, 2 Oct 2008 19:19:00 +0000 (21:19 +0200)
TODO
udev/lib/exported_symbols
udev/lib/libudev-device.c
udev/lib/libudev.h

diff --git a/TODO b/TODO
index 082bb478eb39d4f5d6b8a98a41f01fd0ca6d1b05..ce424c43614db4cb08a9ac9869c007b039724c12 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,5 @@
   convert usb_id to libudev's udev_device
+  add DEVTYPE
 
   o handle spaces in SYMLINK+=, do not create multiple links
   o use libudev device in udev_rules.c
index ffd8d66acdd5d708a6fdb9a12d39a21e0445e592..ff7efeaf752d7e5ba68d1004183af50131d66a65 100644 (file)
@@ -16,6 +16,7 @@ udev_list_entry_get_value
 udev_device_new_from_syspath
 udev_device_new_from_devnum
 udev_device_get_parent
+udev_device_get_parent_with_subsystem
 udev_device_ref
 udev_device_unref
 udev_device_get_udev
index a512537140b19ff76ab46d55518ab4a2d5077f0f..8e4360a7f4c50a5d96f3d83646ce1251a75a9c6d 100644 (file)
@@ -404,6 +404,22 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device)
        return udev_device->parent_device;
 }
 
+struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem)
+{
+       struct udev_device *parent;
+
+       parent = udev_device_get_parent(udev_device);
+       while (parent != NULL) {
+               const char *parent_subsystem;
+
+               parent_subsystem = udev_device_get_subsystem(parent);
+               if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0)
+                       break;
+               parent = udev_device_get_parent(parent);
+       }
+       return parent;
+}
+
 /**
  * udev_device_get_udev:
  * @udev_device: udev device
index 448346e27887a6a9f51c042ac09f25cf465b4d97..fabe59d7d738d99e1fe590cad2233651b325df36 100644 (file)
@@ -60,6 +60,7 @@ struct udev_device;
 extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
 extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
 extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
+extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem);
 extern struct udev_device *udev_device_ref(struct udev_device *udev_device);
 extern void udev_device_unref(struct udev_device *udev_device);
 extern struct udev *udev_device_get_udev(struct udev_device *udev_device);