*/
if (pure_unified_layout(ops)) {
if (strequal(controller, "devices")) {
- if (ops->unified->bpf_device_controller)
+ if (device_utility_controller(ops->unified))
return ops->unified;
break;
} else if (strequal(controller, "freezer")) {
- if (ops->unified->freezer_controller)
+ if (freezer_utility_controller(ops->unified))
return ops->unified;
break;
!faccessat(ops->unified->dfd_con, "cgroup.freeze", F_OK,
AT_SYMLINK_NOFOLLOW)) {
TRACE("Unified hierarchy supports freezer");
- ops->unified->freezer_controller = 1;
+ ops->unified->utilities |= FREEZER_CONTROLLER;
}
}
conf = handler->conf;
unified = ops->unified;
- if (!unified || !unified->bpf_device_controller ||
+ if (!unified || !device_utility_controller(unified) ||
!unified->path_con ||
lxc_list_empty(&(conf->bpf_devices).device_item))
return true;
ops->cgroup_layout = CGROUP_LAYOUT_HYBRID;
} else {
if (bpf_devices_cgroup_supported())
- ops->unified->bpf_device_controller = 1;
+ ops->unified->utilities |= DEVICES_CONTROLLER;
ops->cgroup_layout = CGROUP_LAYOUT_UNIFIED;
}
}
UNIFIED_HIERARCHY = CGROUP2_SUPER_MAGIC,
} cgroupfs_type_magic_t;
+#define DEVICES_CONTROLLER (1U << 0)
+#define FREEZER_CONTROLLER (1U << 1)
+
/* A descriptor for a mounted hierarchy
*
* @controllers
struct /* unified hierarchy specific */ {
char **delegate;
- unsigned int bpf_device_controller : 1;
- unsigned int freezer_controller : 1;
+ unsigned int utilities;
};
char **controllers;
};
+static inline bool device_utility_controller(const struct hierarchy *h)
+{
+ if (h->fs_type == UNIFIED_HIERARCHY && (h->utilities & DEVICES_CONTROLLER))
+ return true;
+ return false;
+}
+
+static inline bool freezer_utility_controller(const struct hierarchy *h)
+{
+ if (h->fs_type == UNIFIED_HIERARCHY && (h->utilities & FREEZER_CONTROLLER))
+ return true;
+ return false;
+}
+
struct cgroup_ops {
/* string constant */
const char *driver;