Lines Matching refs:ctrl

309 #define for_each_ctrl(ctrl)			\
310 for ((ctrl) = controllers; (ctrl)->ctrl_name; (ctrl)++)
314 * If (ctrl) == 0 and multiple V1 (and a V2) hierarchies are mounted,
319 #define for_each_dir(cg, ctrl, t) \
320 for ((t) = (ctrl) ? (cg)->dirs_by_ctrl + (ctrl) : (cg)->dirs; \
322 (t) = (ctrl) ? (cg)->dirs + ROOTS_MAX : (t) + 1)
326 const struct cgroup_ctrl *const ctrl)
328 return !!(ctrl_field & (1 << ctrl->ctrl_indx));
333 const struct cgroup_ctrl *const ctrl)
335 *ctrl_field |= 1 << ctrl->ctrl_indx;
354 static int cgroup_ctrl_on_v2(const struct cgroup_ctrl *const ctrl)
356 return ctrl->ctrl_root && ctrl->ctrl_root->ver == TST_CG_V2;
411 const struct cgroup_ctrl *ctrl;
415 for_each_ctrl(ctrl) {
416 struct cgroup_root *root = ctrl->ctrl_root;
422 ctrl->ctrl_name,
424 ctrl->we_require_it,
435 struct cgroup_ctrl *ctrl;
437 for_each_ctrl(ctrl) {
438 if (!strcmp(ctrl_name, ctrl->ctrl_name))
439 return ctrl;
462 struct cgroup_ctrl *ctrl;
471 ctrl = cgroup_find_ctrl(ctrl_name);
472 if (!ctrl)
473 tst_brk(TBROK, "Could not find ctrl from config. Ctrls changing between calls?");
475 ctrl->we_require_it = we_require_it;
551 struct cgroup_ctrl *ctrl;
619 for_each_ctrl(ctrl) {
620 if (has_ctrl(root->ctrl_field, ctrl))
621 ctrl->ctrl_root = root;
704 static void cgroup_mount_v1(struct cgroup_ctrl *const ctrl)
710 if (ctrl->ctrl_indx == CTRL_BLKIO && controllers[CTRL_IO].ctrl_root) {
717 tmpdir, cgroup_mount_ltp_prefix, ctrl->ctrl_name);
738 if (mount(ctrl->ctrl_name, mnt_path, "cgroup", 0, ctrl->ctrl_name)) {
747 tst_res(TINFO, "Mounted V1 %s CGroup on %s", ctrl->ctrl_name, mnt_path);
749 if (!ctrl->ctrl_root)
752 ctrl->ctrl_root->we_mounted_it = 1;
753 ctrl->ctrl_root->mnt_dir.we_created_it = made_dir;
755 if (ctrl->ctrl_indx == CTRL_MEMORY) {
756 SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd,
808 struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
810 int base = !strcmp(ctrl->ctrl_name, "base");
815 if (!ctrl) {
821 if (ctrl->we_require_it)
822 tst_res(TWARN, "Duplicate %s(%s, )", __func__, ctrl->ctrl_name);
824 ctrl->we_require_it = 1;
826 if (ctrl->ctrl_root)
831 if (ctrl->ctrl_root)
837 if (ctrl->ctrl_root)
841 cgroup_mount_v1(ctrl);
844 ctrl->ctrl_root = roots;
846 if (!ctrl->ctrl_root) {
849 ctrl->ctrl_name);
854 root = ctrl->ctrl_root;
855 add_ctrl(&root->mnt_dir.ctrl_field, ctrl);
857 if (cgroup_ctrl_on_v2(ctrl) && options->needs_ver == TST_CG_V1) {
860 ctrl->ctrl_name);
862 if (!cgroup_ctrl_on_v2(ctrl) && options->needs_ver == TST_CG_V2) {
865 ctrl->ctrl_name);
868 if (cgroup_ctrl_on_v2(ctrl) && !base) {
871 cgsc, "+%s", ctrl->ctrl_name);
874 cgsc, "+%s", ctrl->ctrl_name);
884 if (cgroup_ctrl_on_v2(ctrl)) {
886 cgsc, "+%s", ctrl->ctrl_name);
891 if (ctrl->ctrl_indx == CTRL_CPUSET)
984 struct cgroup_ctrl *ctrl;
1017 for_each_ctrl(ctrl) {
1018 if (!cgroup_ctrl_on_v2(ctrl) || !ctrl->ctrl_root->we_mounted_it
1019 || !strcmp(ctrl->ctrl_name, "base"))
1022 SAFE_FILE_PRINTFAT(ctrl->ctrl_root->mnt_dir.dir_fd,
1024 "-%s", ctrl->ctrl_name);
1041 for_each_ctrl(ctrl) {
1042 ctrl->ctrl_root = NULL;
1043 ctrl->we_require_it = 0;
1057 const struct cgroup_ctrl *ctrl;
1063 for_each_ctrl(ctrl) {
1064 if (!has_ctrl(dir->ctrl_field, ctrl))
1067 cg->dirs_by_ctrl[ctrl->ctrl_indx] = dir;
1072 if (strcmp(ctrl->ctrl_name, "base")) {
1074 "+%s", ctrl->ctrl_name);
1148 const struct cgroup_ctrl *ctrl;
1164 ctrl = cgroup_find_ctrl(ctrl_name);
1166 if (!ctrl) {
1172 for (cfile = ctrl->files; cfile->file_name; cfile++) {
1180 file_name, ctrl->ctrl_name);
1191 const struct cgroup_ctrl *const ctrl = cgroup_find_ctrl(ctrl_name);
1201 if (!ctrl) {
1207 dir = cg->dirs_by_ctrl[ctrl->ctrl_indx];