chiark / gitweb /
udev/libudev: event - move {OLD_,}INTERFACE handling from udevd to libudev
[elogind.git] / src / libudev / libudev-device.c
index 9863901a33ac4f73f3584f0837c55425b1009c07..978b03dd0da02dd97052c7d781da8ccc978b290d 100644 (file)
@@ -439,7 +439,7 @@ static int udev_device_set_syspath(struct udev_device *udev_device, const char *
  * udev_device_set_info_loaded() needs to be set, to avoid trying
  * to use a device without a DEVPATH set
  */
-void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property)
+static void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property)
 {
         if (startswith(property, "DEVPATH=")) {
                 char path[UTIL_PATH_SIZE];
@@ -515,7 +515,7 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
         }
 }
 
-int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device)
+static int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device)
 {
         if (udev_device->maj > 0)
                 udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min));
@@ -1926,6 +1926,7 @@ void udev_device_set_db_persist(struct udev_device *udev_device)
 int udev_device_rename(struct udev_device *udev_device, const char *name)
 {
         _cleanup_free_ char *dirname = NULL;
+        const char *interface;
         char *new_syspath;
         int r;
 
@@ -1942,6 +1943,13 @@ int udev_device_rename(struct udev_device *udev_device, const char *name)
         if (r < 0)
                 return r;
 
+        interface = udev_device_get_property_value(udev_device, "INTERFACE");
+        if (interface) {
+                /* like DEVPATH_OLD, INTERFACE_OLD is not saved to the db, but only stays around for the current event */
+                udev_device_add_property(udev_device, "INTERFACE_OLD", interface);
+                udev_device_add_property(udev_device, "INTERFACE", name);
+        }
+
         return 0;
 }