summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-09-11 05:42:18 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-09-11 05:45:21 +0200
commit8aae9a66fae7aa7f1f7563f0bf14f9ab3de916bd (patch)
tree9a17ee14360d57b2864e315894374ab87a9bb816
parentlibudev-monitor: use assert_return() in many places (diff)
downloadsystemd-8aae9a66fae7aa7f1f7563f0bf14f9ab3de916bd.tar.xz
systemd-8aae9a66fae7aa7f1f7563f0bf14f9ab3de916bd.zip
sd-device,libudev: make an argument for *_set_sysattr_value() const
-rw-r--r--TODO2
-rw-r--r--src/libsystemd/sd-device/sd-device.c2
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev.h2
-rw-r--r--src/systemd/sd-device.h2
5 files changed, 4 insertions, 6 deletions
diff --git a/TODO b/TODO
index 65dc51b225..4dcd102ec5 100644
--- a/TODO
+++ b/TODO
@@ -438,8 +438,6 @@ Features:
* hostnamectl: show root image uuid
-* sysfs set api in libudev is not const
-
* Find a solution for SMACK capabilities stuff:
http://lists.freedesktop.org/archives/systemd-devel/2014-December/026188.html
diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
index c61e98fe72..b020e0d55a 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -1822,7 +1822,7 @@ static void device_remove_sysattr_value(sd_device *device, const char *_key) {
/* set the attribute and save it in the cache. If a NULL value is passed the
* attribute is cleared from the cache */
-_public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, char *_value) {
+_public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, const char *_value) {
_cleanup_close_ int fd = -1;
_cleanup_free_ char *value = NULL;
const char *syspath;
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 95ad5ced57..2cd5b48fea 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -763,7 +763,7 @@ _public_ const char *udev_device_get_sysattr_value(struct udev_device *udev_devi
*
* Returns: Negative error code on failure or 0 on success.
**/
-_public_ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value) {
+_public_ int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, const char *value) {
int r;
assert_return(udev_device, -EINVAL);
diff --git a/src/libudev/libudev.h b/src/libudev/libudev.h
index fa4eaeb969..fa2a35d1f9 100644
--- a/src/libudev/libudev.h
+++ b/src/libudev/libudev.h
@@ -90,7 +90,7 @@ const char *udev_device_get_action(struct udev_device *udev_device);
unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device);
const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
-int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, char *value);
+int udev_device_set_sysattr_value(struct udev_device *udev_device, const char *sysattr, const char *value);
int udev_device_has_tag(struct udev_device *udev_device, const char *tag);
/*
diff --git a/src/systemd/sd-device.h b/src/systemd/sd-device.h
index 3a51c135d4..406db8866d 100644
--- a/src/systemd/sd-device.h
+++ b/src/systemd/sd-device.h
@@ -68,7 +68,7 @@ int sd_device_has_tag(sd_device *device, const char *tag);
int sd_device_get_property_value(sd_device *device, const char *key, const char **value);
int sd_device_get_sysattr_value(sd_device *device, const char *sysattr, const char **_value);
-int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, char *value);
+int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, const char *value);
/* device enumerator */