summaryrefslogtreecommitdiff
path: root/src/shared/bus-unit-util.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2018-06-13 14:16:35 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-08-22 16:46:18 +0200
commit6ae4283cb14c4e4a895f4bbba703804e4128c86c (patch)
tree3186c0cb45979d95deb1f78c83f229defe49e499 /src/shared/bus-unit-util.c
parent71d1700afa6095ee6335eb5c88bd30a820546ec0 (diff)
downloadsystemd-6ae4283cb14c4e4a895f4bbba703804e4128c86c.tar.gz
core: add IODeviceLatencyTargetSec
This adds support for the following proposed latency based IO control mechanism. https://lkml.org/lkml/2018/6/5/428
Diffstat (limited to 'src/shared/bus-unit-util.c')
-rw-r--r--src/shared/bus-unit-util.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 28b830bd41..e1354b0d0f 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -552,6 +552,37 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons
return 1;
}
+ if (streq(field, "IODeviceLatencyTargetSec")) {
+ const char *field_usec = "IODeviceLatencyTargetUSec";
+
+ if (isempty(eq))
+ r = sd_bus_message_append(m, "(sv)", field_usec, "a(st)", USEC_INFINITY);
+ else {
+ const char *path, *target, *e;
+ usec_t usec;
+
+ e = strchr(eq, ' ');
+ if (!e) {
+ log_error("Failed to parse %s value %s.", field, eq);
+ return -EINVAL;
+ }
+
+ path = strndupa(eq, e - eq);
+ target = e+1;
+
+ r = parse_sec(target, &usec);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse %s value %s: %m", field, target);
+
+ r = sd_bus_message_append(m, "(sv)", field_usec, "a(st)", 1, path, usec);
+ }
+
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ return 1;
+ }
+
if (STR_IN_SET(field, "IPAddressAllow", "IPAddressDeny")) {
unsigned char prefixlen;
union in_addr_union prefix = {};