summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-08-27 13:36:55 +0800
committerLennart Poettering <lennart@poettering.net>2013-09-10 18:32:32 +0200
commitb8ab2dc6c9eb8d6c738524f2ab48931855e3a08a (patch)
tree774952e2df1b08c6096c5900dd5856607839ab11 /src/systemctl
parent7239c1707a69aff63425e8b6570cfabbd7386f61 (diff)
systemctl: show BlockIODeviceWeight for unit
We can use systemctl show unitname to show the BlockIODeviceWeight of unit.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 0aeae91b35..a305c3d87d 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3315,6 +3315,24 @@ static int print_property(const char *name, DBusMessageIter *iter) {
}
return 0;
+ } else if (dbus_message_iter_get_element_type(iter) == DBUS_TYPE_STRUCT && streq(name, "BlockIODeviceWeight")) {
+ DBusMessageIter sub, sub2;
+
+ dbus_message_iter_recurse(iter, &sub);
+ while (dbus_message_iter_get_arg_type(&sub) == DBUS_TYPE_STRUCT) {
+ const char *path;
+ uint64_t weight;
+
+ dbus_message_iter_recurse(&sub, &sub2);
+
+ if (bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_STRING, &path, true) >= 0 &&
+ bus_iter_get_basic_and_next(&sub2, DBUS_TYPE_UINT64, &weight, false) >= 0)
+ printf("%s=%s %" PRIu64 "\n", name, strna(path), weight);
+
+ dbus_message_iter_next(&sub);
+ }
+ return 0;
+
} else if (dbus_message_iter_get_element_type(iter) == DBUS_TYPE_STRUCT && (streq(name, "BlockIOReadBandwidth") || streq(name, "BlockIOWriteBandwidth"))) {
DBusMessageIter sub, sub2;