summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-device.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-02-08 11:13:01 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-02-08 11:13:01 -0500
commit7edee6302ec0759f5bb84f07c0c352377be7ac5d (patch)
tree2c43650f644386b304bc8e7ef4ccd3226ca73fb7 /src/libudev/libudev-device.c
parent318c9e4c8ce45ffa800bbd14d3f994c3c8692e7f (diff)
udev: event - introduce and use internal udev_device_shallow_clone()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
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 a7446bff77..24c8d3b02c 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -1922,3 +1922,24 @@ void udev_device_set_db_persist(struct udev_device *udev_device)
{
udev_device->db_persist = true;
}
+
+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;
+}