[systemd-commits] docs/libudev Makefile.am src/libudev src/udev

Kay Sievers kay at kemper.freedesktop.org
Fri Aug 10 10:57:54 PDT 2012


 Makefile.am                       |    6 +++---
 docs/libudev/libudev-sections.txt |    1 +
 src/libudev/libudev-device.c      |   20 +++++++++++++++++++-
 src/libudev/libudev-enumerate.c   |    2 +-
 src/libudev/libudev-private.h     |    1 -
 src/libudev/libudev.h             |    1 +
 src/libudev/libudev.sym           |    5 +++++
 src/udev/udev-node.c              |    2 +-
 src/udev/udev-watch.c             |    4 ++--
 9 files changed, 33 insertions(+), 9 deletions(-)

New commits:
commit dbf61afb29e016fe1b4ac48312a782df1d60a3e6
Author: Kay Sievers <kay at vrfy.org>
Date:   Fri Aug 10 19:56:57 2012 +0200

    udev: export udev_device_new_from_device_id()

diff --git a/Makefile.am b/Makefile.am
index ad8f71d..9062dd6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,9 +26,9 @@ SUBDIRS = . po
 # remove targets if the command fails
 .DELETE_ON_ERROR:
 
-LIBUDEV_CURRENT=1
-LIBUDEV_REVISION=4
-LIBUDEV_AGE=0
+LIBUDEV_CURRENT=2
+LIBUDEV_REVISION=0
+LIBUDEV_AGE=1
 
 LIBGUDEV_CURRENT=1
 LIBGUDEV_REVISION=2
diff --git a/docs/libudev/libudev-sections.txt b/docs/libudev/libudev-sections.txt
index 9f41ca6..11e8e1c 100644
--- a/docs/libudev/libudev-sections.txt
+++ b/docs/libudev/libudev-sections.txt
@@ -33,6 +33,7 @@ udev_device_get_udev
 udev_device_new_from_syspath
 udev_device_new_from_devnum
 udev_device_new_from_subsystem_sysname
+udev_device_new_from_device_id
 udev_device_new_from_environment
 udev_device_get_parent
 udev_device_get_parent_with_subsystem_devtype
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 98077e7..1bef709 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -714,7 +714,25 @@ _public_ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char
         return udev_device_new_from_syspath(udev, path);
 }
 
-struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id)
+/**
+ * udev_device_new_from_device_id:
+ * @udev: udev library context
+ * @id: text string identifying a kernel device
+ *
+ * Create new udev device, and fill in information from the sys
+ * device and the udev database entry. The device is looked-up
+ * by a special string:
+ *   b8:2          - block device major:minor
+ *   c128:1        - char device major:minor
+ *   n3            - network device ifindex
+ *   +sound:card29 - kernel driver core subsystem:device name
+ *
+ * The initial refcount is 1, and needs to be decremented to
+ * release the resources of the udev device.
+ *
+ * Returns: a new udev device, or #NULL, if it does not exist
+ **/
+_public_ struct udev_device *udev_device_new_from_device_id(struct udev *udev, char *id)
 {
         char type;
         int maj, min;
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index a945758..f0305a4 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -789,7 +789,7 @@ static int scan_devices_tags(struct udev_enumerate *udev_enumerate)
                         if (dent->d_name[0] == '.')
                                 continue;
 
-                        dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name);
+                        dev = udev_device_new_from_device_id(udev_enumerate->udev, dent->d_name);
                         if (dev == NULL)
                                 continue;
 
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 5990605..4234223 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -47,7 +47,6 @@ struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev);
 
 /* libudev-device.c */
 struct udev_device *udev_device_new(struct udev *udev);
-struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id);
 mode_t udev_device_get_devnode_mode(struct udev_device *udev_device);
 int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
 int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
index 8643984..799f470 100644
--- a/src/libudev/libudev.h
+++ b/src/libudev/libudev.h
@@ -73,6 +73,7 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device);
 struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
 struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
 struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
+struct udev_device *udev_device_new_from_device_id(struct udev *udev, char *id);
 struct udev_device *udev_device_new_from_environment(struct udev *udev);
 /* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */
 struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
index 47683ec..5b2c3d3 100644
--- a/src/libudev/libudev.sym
+++ b/src/libudev/libudev.sym
@@ -95,3 +95,8 @@ global:
 local:
         *;
 };
+
+LIBUDEV_189 {
+global:
+        udev_device_new_from_device_id;
+} LIBUDEV_183;
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 738d02f..df4c8f0 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -159,7 +159,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons
                 if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0)
                         continue;
 
-                dev_db = udev_device_new_from_id_filename(udev, dent->d_name);
+                dev_db = udev_device_new_from_device_id(udev, dent->d_name);
                 if (dev_db != NULL) {
                         const char *devnode;
 
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 1091ec8..c27a280 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -75,7 +75,7 @@ void udev_watch_restore(struct udev *udev)
                                 goto unlink;
                         device[len] = '\0';
 
-                        dev = udev_device_new_from_id_filename(udev, device);
+                        dev = udev_device_new_from_device_id(udev, device);
                         if (dev == NULL)
                                 goto unlink;
 
@@ -154,5 +154,5 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
                 return NULL;
         device[len] = '\0';
 
-        return udev_device_new_from_id_filename(udev, device);
+        return udev_device_new_from_device_id(udev, device);
 }



More information about the systemd-commits mailing list