diff options
author | Tejun Heo <htejun@fb.com> | 2016-11-21 20:45:53 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-18 23:51:13 +0100 |
commit | 415fc41ceaeada2e32639f24f134b1c248b9e43f (patch) | |
tree | 5e8a3a3af6bfaec96c4653ad36e8090f81d86a30 /src/cgls | |
parent | nspawn: fix cgroup mode detection (diff) | |
download | systemd-415fc41ceaeada2e32639f24f134b1c248b9e43f.tar.xz systemd-415fc41ceaeada2e32639f24f134b1c248b9e43f.zip |
core: simplify cg_[all_]unified()
cg_[all_]unified() test whether a specific controller or all controllers are on
the unified hierarchy. While what's being asked is a simple binary question,
the callers must assume that the functions may fail any time, which
unnecessarily complicates their usages. This complication is unnecessary.
Internally, the test result is cached anyway and there are only a few places
where the test actually needs to be performed.
This patch simplifies cg_[all_]unified().
* cg_[all_]unified() are updated to return bool. If the result can't be
decided, assertion failure is triggered. Error handlings from their callers
are dropped.
* cg_unified_flush() is updated to calculate the new result synchrnously and
return whether it succeeded or not. Places which need to flush the test
result are updated to test for failure. This ensures that all the following
cg_[all_]unified() tests succeed.
* Places which expected possible cg_[all_]unified() failures are updated to
call and test cg_unified_flush() before calling cg_[all_]unified(). This
includes functions used while setting up mounts during boot and
manager_setup_cgroup().
Diffstat (limited to 'src/cgls')
-rw-r--r-- | src/cgls/cgls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index 5574c14555..40db82f9ae 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -158,7 +158,7 @@ static int parse_argv(int argc, char *argv[]) { static void show_cg_info(const char *controller, const char *path) { - if (cg_all_unified() <= 0 && controller && !streq(controller, SYSTEMD_CGROUP_CONTROLLER)) + if (!cg_all_unified() && controller && !streq(controller, SYSTEMD_CGROUP_CONTROLLER)) printf("Controller %s; ", controller); printf("Control group %s:\n", isempty(path) ? "/" : path); |