+static CGroupControllerMask unit_get_target_mask(Unit *u) {
+ CGroupControllerMask mask;
+
+ mask = unit_get_cgroup_mask(u) | unit_get_members_mask(u) | unit_get_siblings_mask(u);
+ mask &= u->manager->cgroup_supported;
+
+ return mask;
+}
+
+/* Recurse from a unit up through its containing slices, propagating
+ * mask bits upward. A unit is also member of itself. */
+void unit_update_member_masks(Unit *u) {
+ u->cgroup_members_mask |= unit_get_cgroup_mask(u);
+ if (UNIT_ISSET(u->slice)) {
+ Unit *s = UNIT_DEREF(u->slice);
+ s->cgroup_members_mask |= u->cgroup_members_mask;
+ unit_update_member_masks(s);
+ }
+}
+