chiark / gitweb /
udev: get rid of SYSCONFDIR
[elogind.git] / src / libudev / libudev-device.c
index 98077e777de7c4787d4c5d1a47c45c30af17eaed..08476e6596aa8f8cb62bb3b97c965f690b591618 100644 (file)
@@ -378,12 +378,12 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
                 next = strchr(slink, ' ');
                 while (next != NULL) {
                         next[0] = '\0';
-                        udev_device_add_devlink(udev_device, slink, 0);
+                        udev_device_add_devlink(udev_device, slink);
                         slink = &next[1];
                         next = strchr(slink, ' ');
                 }
                 if (slink[0] != '\0')
-                        udev_device_add_devlink(udev_device, slink, 0);
+                        udev_device_add_devlink(udev_device, slink);
         } else if (startswith(property, "TAGS=")) {
                 char tags[UTIL_PATH_SIZE];
                 char *next;
@@ -503,7 +503,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
                 switch(line[0]) {
                 case 'S':
                         util_strscpyl(filename, sizeof(filename), "/dev/", val, NULL);
-                        udev_device_add_devlink(udev_device, filename, 0);
+                        udev_device_add_devlink(udev_device, filename);
                         break;
                 case 'L':
                         udev_device_set_devlink_priority(udev_device, atoi(val));
@@ -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;
@@ -1106,7 +1124,7 @@ _public_ const char *udev_device_get_sysname(struct udev_device *udev_device)
  *
  * Get the instance number of the device.
  *
- * Returns: the trailing number string of of the device name
+ * Returns: the trailing number string of the device name
  **/
 _public_ const char *udev_device_get_sysnum(struct udev_device *udev_device)
 {
@@ -1487,7 +1505,7 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode
         return 0;
 }
 
-int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique)
+int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink)
 {
         struct udev_list_entry *list_entry;
 
@@ -1495,8 +1513,6 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink
         list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL);
         if (list_entry == NULL)
                 return -ENOMEM;
-        if (unique)
-                udev_list_entry_set_num(list_entry, true);
         return 0;
 }