summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-device.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-01-26 14:12:45 +0100
committerTom Gundersen <teg@jklm.no>2015-01-26 14:12:45 +0100
commitfa639f3ae770ffccdd9f97430b0883d01bc821ce (patch)
tree2226a563d42b6d6d1e107ac879bc9b6956922300 /src/libudev/libudev-device.c
parent243d182543c7edc3980e1ae41712bb0b96df46bd (diff)
udev: event - introduce and use internal udev_device_shallow_clone()
Diffstat (limited to 'src/libudev/libudev-device.c')
-rw-r--r--src/libudev/libudev-device.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 193c706d89..08331a2329 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -1944,3 +1944,24 @@ int udev_device_rename(struct udev_device *udev_device, const char *name)
return 0;
}
+
+struct udev_device *udev_device_shallow_clone(struct udev_device *old_device)
+{
+ struct udev_device *device;
+
+ if (old_device == NULL)
+ return NULL;
+
+ device = udev_device_new(old_device->udev);
+ if (!device) {
+ errno = ENOMEM;
+
+ return NULL;
+ }
+
+ udev_device_set_syspath(device, udev_device_get_syspath(old_device));
+ udev_device_set_subsystem(device, udev_device_get_subsystem(old_device));
+ udev_device_set_devnum(device, udev_device_get_devnum(old_device));
+
+ return device;
+}