Lines Matching refs:root

28  * traverse from leaf towards root.
34 /* Shortcut to root */
39 * this field. So it may be different from root->css_field.
51 /* The root of a CGroup hierarchy/tree */
57 * controllers found while scanning this root.
384 "Lack permission to make '%s/%s'; premake it or run as root",
416 struct cgroup_root *root = ctrl->ctrl_root;
418 if (!root)
423 root->ver,
425 root->mnt_path,
426 root->we_mounted_it,
427 root->ltp_dir.we_created_it,
428 root->test_dir.dir_name ? root->test_dir.dir_name : "NULL");
447 struct cgroup_root *root;
449 for_each_root(root) {
450 if (!strcmp(root->mnt_path, mnt_path))
451 return root;
461 struct cgroup_root *root;
477 root = cgroup_find_root(mnt_path);
478 if (!root)
479 tst_brk(TBROK, "Could not find root from config. Config possibly malformed?");
482 root->we_mounted_it = 1;
484 if (!root->ltp_dir.dir_name) {
485 cgroup_dir_mk(&root->mnt_dir, cgroup_ltp_dir, &root->ltp_dir);
486 cgroup_dir_mk(&root->ltp_dir, cgroup_ltp_drain_dir, &root->drain_dir);
488 root->ltp_dir.we_created_it = 1;
489 root->drain_dir.we_created_it = 1;
493 if (!root->test_dir.dir_name && strcmp(test_dir_name, "NULL")) {
495 cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir);
496 root->test_dir.we_created_it = 1;
541 * Each controller partition has its own hierarchy (root) which we
549 struct cgroup_root *root = roots;
569 if (root->ver && ctrl_field == root->ctrl_field)
572 if (root->ctrl_field)
575 root->ver = TST_CG_V2;
591 for_each_v1_root(root) {
592 if (!(ctrl_field & root->ctrl_field))
595 if (ctrl_field == root->ctrl_field)
600 "Check '%s' and '%s'", root->mnt_path, mnt_dir);
603 if (root >= roots + ROOTS_MAX) {
609 root->ver = TST_CG_V1;
612 strcpy(root->mnt_path, mnt_dir);
613 root->mnt_dir.dir_root = root;
614 root->mnt_dir.dir_name = root->mnt_path;
615 root->mnt_dir.dir_fd = mnt_dfd;
616 root->ctrl_field = ctrl_field;
617 root->no_cpuset_prefix = no_prefix;
620 if (has_ctrl(root->ctrl_field, ctrl))
621 ctrl->ctrl_root = root;
673 "Lack permission to make %s, premake it or run as root",
712 "IO controller found on V2 root, skipping blkio mount that would unmount IO controller");
729 "Lack permission to make %s, premake it or run as root",
762 static void cgroup_copy_cpuset(const struct cgroup_root *const root)
768 const char *const *const fname = root->no_cpuset_prefix ? n0 : n1;
771 SAFE_FILE_READAT(root->mnt_dir.dir_fd,
773 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
794 * for all children of root. Then we create hierarchy described in
798 * from root to the ltp group and set clone_children on the ltp group
809 struct cgroup_root *root;
854 root = ctrl->ctrl_root;
855 add_ctrl(&root->mnt_dir.ctrl_field, ctrl);
869 if (root->we_mounted_it) {
870 SAFE_FILE_PRINTFAT(root->mnt_dir.dir_fd,
873 tst_file_printfat(root->mnt_dir.dir_fd,
878 if (!root->ltp_dir.dir_fd)
879 cgroup_dir_mk(&root->mnt_dir, cgroup_ltp_dir, &root->ltp_dir);
881 root->ltp_dir.ctrl_field |= root->mnt_dir.ctrl_field;
885 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
888 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd,
892 cgroup_copy_cpuset(root);
896 cgroup_dir_mk(&root->ltp_dir, cgroup_ltp_drain_dir, &root->drain_dir);
903 cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir);
935 static void close_path_fds(struct cgroup_root *const root)
937 if (root->test_dir.dir_fd > 0)
938 SAFE_CLOSE(root->test_dir.dir_fd);
939 if (root->ltp_dir.dir_fd > 0)
940 SAFE_CLOSE(root->ltp_dir.dir_fd);
941 if (root->drain_dir.dir_fd > 0)
942 SAFE_CLOSE(root->drain_dir.dir_fd);
943 if (root->mnt_dir.dir_fd > 0)
944 SAFE_CLOSE(root->mnt_dir.dir_fd);
962 * test. Note that successfully unmounting a CGroup root does not
966 * we can not move them to the root CGroup. CGroups can only be
967 * removed when they have no members and only leaf or root CGroups may
969 * their own CGroups they must move themselves either to root or
973 * If we have access to root and created the LTP CGroup we then move
974 * the test process to root and destroy the drain and LTP
983 struct cgroup_root *root;
989 for_each_root(root) {
990 if (!root->test_dir.dir_name)
993 cgroup_drain(root->ver,
994 root->test_dir.dir_fd, root->drain_dir.dir_fd);
995 SAFE_UNLINKAT(root->ltp_dir.dir_fd, root->test_dir.dir_name,
999 for_each_root(root) {
1000 if (!root->ltp_dir.we_created_it)
1003 cgroup_drain(root->ver,
1004 root->drain_dir.dir_fd, root->mnt_dir.dir_fd);
1006 if (root->drain_dir.dir_name) {
1007 SAFE_UNLINKAT(root->ltp_dir.dir_fd,
1008 root->drain_dir.dir_name, AT_REMOVEDIR);
1011 if (root->ltp_dir.dir_name) {
1012 SAFE_UNLINKAT(root->mnt_dir.dir_fd,
1013 root->ltp_dir.dir_name, AT_REMOVEDIR);
1027 for_each_root(root) {
1028 if (!root->we_mounted_it)
1031 /* This probably does not result in the CGroup root
1034 if (umount2(root->mnt_path, MNT_DETACH))
1037 SAFE_RMDIR(root->mnt_path);
1046 for_each_root(root)
1047 close_path_fds(root);
1268 struct cgroup_root *root;
1276 for_each_root(root) {
1278 cg == &test_group ? &root->test_dir : &root->drain_dir;