cgroups/cgfsng: rework cgfsng_get_hierarchies()

parent 9a8bead2
...@@ -1978,24 +1978,27 @@ __cgfsng_ops static int cgfsng_num_hierarchies(struct cgroup_ops *ops) ...@@ -1978,24 +1978,27 @@ __cgfsng_ops static int cgfsng_num_hierarchies(struct cgroup_ops *ops)
return i; return i;
} }
__cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n, char ***out) __cgfsng_ops static bool cgfsng_get_hierarchies(struct cgroup_ops *ops, int n,
char ***out)
{ {
int i; int i;
if (!ops)
return ret_set_errno(false, ENOENT);
if (!ops->hierarchies) if (!ops->hierarchies)
return false; return false;
/* sanity check n */ /* sanity check n */
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
if (!ops->hierarchies[i]) if (!ops->hierarchies[i])
return false; return ret_set_errno(false, ENOENT);
*out = ops->hierarchies[i]->controllers; *out = ops->hierarchies[i]->controllers;
return true; return true;
} }
static bool cg_legacy_freeze(struct cgroup_ops *ops) static bool cg_legacy_freeze(struct cgroup_ops *ops)
{ {
__do_free char *path = NULL; __do_free char *path = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment