• Home
  • Raw
  • Download

Lines Matching refs:root

306 	struct cgroup_root *root;  in tst_cgroup_print_config()  local
312 root = ctrl->ctrl_root; in tst_cgroup_print_config()
314 if (!root) in tst_cgroup_print_config()
319 root->no_cpuset_prefix ? "[noprefix]" : "", in tst_cgroup_print_config()
320 root->ver == TST_CGROUP_V1 ? "V1" : "V2", in tst_cgroup_print_config()
321 root->mnt_path); in tst_cgroup_print_config()
360 struct cgroup_root *root = roots; in cgroup_root_scan() local
380 if (root->ver && ctrl_field == root->ctrl_field) in cgroup_root_scan()
383 if (root->ctrl_field) in cgroup_root_scan()
386 root->ver = TST_CGROUP_V2; in cgroup_root_scan()
402 for_each_v1_root(root) { in cgroup_root_scan()
403 if (!(ctrl_field & root->ctrl_field)) in cgroup_root_scan()
406 if (ctrl_field == root->ctrl_field) in cgroup_root_scan()
411 "Check '%s' and '%s'", root->mnt_path, mnt_dir); in cgroup_root_scan()
414 if (root >= roots + ROOTS_MAX) { in cgroup_root_scan()
420 root->ver = TST_CGROUP_V1; in cgroup_root_scan()
423 strcpy(root->mnt_path, mnt_dir); in cgroup_root_scan()
424 root->mnt_dir.dir_root = root; in cgroup_root_scan()
425 root->mnt_dir.dir_name = root->mnt_path; in cgroup_root_scan()
426 root->mnt_dir.dir_fd = mnt_dfd; in cgroup_root_scan()
427 root->ctrl_field = ctrl_field; in cgroup_root_scan()
428 root->no_cpuset_prefix = no_prefix; in cgroup_root_scan()
431 if (has_ctrl(root->ctrl_field, ctrl)) in cgroup_root_scan()
432 ctrl->ctrl_root = root; in cgroup_root_scan()
556 static void cgroup_copy_cpuset(const struct cgroup_root *const root) in cgroup_copy_cpuset() argument
562 const char *const *const fname = root->no_cpuset_prefix ? n0 : n1; in cgroup_copy_cpuset()
565 SAFE_FILE_READAT(root->mnt_dir.dir_fd, in cgroup_copy_cpuset()
567 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd, in cgroup_copy_cpuset()
603 struct cgroup_root *root; in tst_cgroup_require() local
643 root = ctrl->ctrl_root; in tst_cgroup_require()
644 add_ctrl(&root->mnt_dir.ctrl_field, ctrl); in tst_cgroup_require()
647 if (root->we_mounted_it) { in tst_cgroup_require()
648 SAFE_FILE_PRINTFAT(root->mnt_dir.dir_fd, in tst_cgroup_require()
651 tst_file_printfat(root->mnt_dir.dir_fd, in tst_cgroup_require()
656 if (!root->ltp_dir.dir_fd) in tst_cgroup_require()
657 cgroup_dir_mk(&root->mnt_dir, cgroup_ltp_dir, &root->ltp_dir); in tst_cgroup_require()
659 root->ltp_dir.ctrl_field |= root->mnt_dir.ctrl_field; in tst_cgroup_require()
662 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd, in tst_cgroup_require()
665 SAFE_FILE_PRINTFAT(root->ltp_dir.dir_fd, in tst_cgroup_require()
669 cgroup_copy_cpuset(root); in tst_cgroup_require()
672 cgroup_dir_mk(&root->ltp_dir, cgroup_ltp_drain_dir, &root->drain_dir); in tst_cgroup_require()
675 cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir); in tst_cgroup_require()
707 static void close_path_fds(struct cgroup_root *const root) in close_path_fds() argument
709 if (root->test_dir.dir_fd > 0) in close_path_fds()
710 SAFE_CLOSE(root->test_dir.dir_fd); in close_path_fds()
711 if (root->ltp_dir.dir_fd > 0) in close_path_fds()
712 SAFE_CLOSE(root->ltp_dir.dir_fd); in close_path_fds()
713 if (root->drain_dir.dir_fd > 0) in close_path_fds()
714 SAFE_CLOSE(root->drain_dir.dir_fd); in close_path_fds()
715 if (root->mnt_dir.dir_fd > 0) in close_path_fds()
716 SAFE_CLOSE(root->mnt_dir.dir_fd); in close_path_fds()
755 struct cgroup_root *root; in tst_cgroup_cleanup() local
761 for_each_root(root) { in tst_cgroup_cleanup()
762 if (!root->test_dir.dir_name) in tst_cgroup_cleanup()
765 cgroup_drain(root->ver, in tst_cgroup_cleanup()
766 root->test_dir.dir_fd, root->drain_dir.dir_fd); in tst_cgroup_cleanup()
767 SAFE_UNLINKAT(root->ltp_dir.dir_fd, root->test_dir.dir_name, in tst_cgroup_cleanup()
771 for_each_root(root) { in tst_cgroup_cleanup()
772 if (!root->ltp_dir.we_created_it) in tst_cgroup_cleanup()
775 cgroup_drain(root->ver, in tst_cgroup_cleanup()
776 root->drain_dir.dir_fd, root->mnt_dir.dir_fd); in tst_cgroup_cleanup()
778 if (root->drain_dir.dir_name) { in tst_cgroup_cleanup()
779 SAFE_UNLINKAT(root->ltp_dir.dir_fd, in tst_cgroup_cleanup()
780 root->drain_dir.dir_name, AT_REMOVEDIR); in tst_cgroup_cleanup()
783 if (root->ltp_dir.dir_name) { in tst_cgroup_cleanup()
784 SAFE_UNLINKAT(root->mnt_dir.dir_fd, in tst_cgroup_cleanup()
785 root->ltp_dir.dir_name, AT_REMOVEDIR); in tst_cgroup_cleanup()
798 for_each_root(root) { in tst_cgroup_cleanup()
799 if (!root->we_mounted_it) in tst_cgroup_cleanup()
805 if (umount2(root->mnt_path, MNT_DETACH)) in tst_cgroup_cleanup()
808 SAFE_RMDIR(root->mnt_path); in tst_cgroup_cleanup()
817 for_each_root(root) in tst_cgroup_cleanup()
818 close_path_fds(root); in tst_cgroup_cleanup()
1035 struct cgroup_root *root; in cgroup_group_from_roots() local
1042 for_each_root(root) { in cgroup_group_from_roots()
1043 dir = (typeof(dir))(((char *)root) + tree_off); in cgroup_group_from_roots()