diff options
author | Tom Gundersen <teg@jklm.no> | 2015-01-26 13:33:00 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-01-26 13:33:00 +0100 |
commit | 243d182543c7edc3980e1ae41712bb0b96df46bd (patch) | |
tree | 4a24cd39381cc5edc5665e2009a71451aa3842c2 /src/libudev/libudev-device.c | |
parent | df99a9ef5bb7a89b92ccfb103b2f3e7046c62ef5 (diff) |
udev: event - move renaming of udev_device to libudev
This is not exposed in the public API. We want to simplify the internal libudev-device API as much as possible
so that it will be simpler to rip the whole thing out in the future.
Diffstat (limited to 'src/libudev/libudev-device.c')
-rw-r--r-- | src/libudev/libudev-device.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index a7446bff77..193c706d89 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -1922,3 +1922,25 @@ void udev_device_set_db_persist(struct udev_device *udev_device) { udev_device->db_persist = true; } + +int udev_device_rename(struct udev_device *udev_device, const char *name) +{ + _cleanup_free_ char *dirname = NULL; + char *new_syspath; + int r; + + if (udev_device == NULL || name == NULL) + return -EINVAL; + + dirname = dirname_malloc(udev_device->syspath); + if (!dirname) + return -ENOMEM; + + new_syspath = strappenda(dirname, "/", name); + + r = udev_device_set_syspath(udev_device, new_syspath); + if (r < 0) + return r; + + return 0; +} |