diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-02-11 16:53:37 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-02-11 16:53:37 -0500 |
commit | 0a5fbf1cdb55852d2a80fafa871b63c93c52c413 (patch) | |
tree | 6f591d28a9156a1ef11ea8968d0b72738c600581 /src/libudev | |
parent | e0bb33e4a80f8b0ada8283cb731377f5103dd0d8 (diff) |
Minor cleanups
Diffstat (limited to 'src/libudev')
-rw-r--r-- | src/libudev/libudev-device.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index 6b7de7e5ef..9863901a33 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -1923,6 +1923,28 @@ 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 = strjoina(dirname, "/", name); + + r = udev_device_set_syspath(udev_device, new_syspath); + if (r < 0) + return r; + + return 0; +} + struct udev_device *udev_device_shallow_clone(struct udev_device *old_device) { struct udev_device *device; @@ -1988,25 +2010,3 @@ struct udev_device *udev_device_new_from_nulstr(struct udev *udev, char *nulstr, return device; } - -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 = strjoina(dirname, "/", name); - - r = udev_device_set_syspath(udev_device, new_syspath); - if (r < 0) - return r; - - return 0; -} |