summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorTejun Heo <htejun@fb.com>2016-05-18 13:50:56 -0700
committerSven Eden <yamakuzure@gmx.net>2017-06-16 10:12:58 +0200
commit27d892d63572af4ddd98401075a7959d5b81f02f (patch)
tree98dad4dbe605c81362859360d71fcf69c08eb59d /src/shared
parentcd87dbd536df7a454ce0faadac24116d21e2b3a8 (diff)
core: introduce CGroupIOLimitType enums
Currently, there are two cgroup IO limits, bandwidth max for read and write, and they are hard-coded in various places. This is fine for two limits but IO is expected to grow more limits - low, high and max limits for bandwidth and IOPS - and hard-coding each limit won't make sense. This patch replaces hard-coded limits with an array indexed by CGroupIOLimitType and accompanying string and default value tables so that new limits can be added trivially.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-unit-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index ff5dceaed..68ec4b4e6 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -284,8 +284,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
r = sd_bus_message_append(m, "v", "a(ss)", 1, path, rwm);
}
- } else if (STR_IN_SET(field, "IOReadBandwidthMax", "IOWriteBandwidthMax",
- "BlockIOReadBandwidth", "BlockIOWriteBandwidth")) {
+ } else if (cgroup_io_limit_type_from_string(field) >= 0 || STR_IN_SET(field, "BlockIOReadBandwidth", "BlockIOWriteBandwidth")) {
if (isempty(eq))
r = sd_bus_message_append(m, "v", "a(st)", 0);