Lines Matching defs:fs

41 #include "fs-util.h"
61 _cleanup_free_ char *fs = NULL;
67 r = cg_get_path(controller, path, "cgroup.procs", &fs);
71 f = fopen(fs, "re");
105 _cleanup_free_ char *fs = NULL;
113 r = cg_get_path(controller, path, NULL, &fs);
117 d = opendir(fs);
467 * /sys/fs/cgroup/ we want to mount it to. Effectively, this
478 static int join_path_legacy(const char *controller, const char *path, const char *suffix, char **fs) {
482 assert(fs);
488 t = strappend("/sys/fs/cgroup/", dn);
490 t = strjoin("/sys/fs/cgroup/", dn, "/", suffix, NULL);
492 t = strjoin("/sys/fs/cgroup/", dn, "/", path, NULL);
494 t = strjoin("/sys/fs/cgroup/", dn, "/", path, "/", suffix, NULL);
498 *fs = t;
502 static int join_path_unified(const char *path, const char *suffix, char **fs) {
505 assert(fs);
508 t = strdup("/sys/fs/cgroup");
510 t = strappend("/sys/fs/cgroup/", suffix);
512 t = strappend("/sys/fs/cgroup/", path);
514 t = strjoin("/sys/fs/cgroup/", path, "/", suffix, NULL);
518 *fs = t;
522 int cg_get_path(const char *controller, const char *path, const char *suffix, char **fs) {
525 assert(fs);
545 *fs = path_kill_slashes(t);
557 r = join_path_unified(path, suffix, fs);
559 r = join_path_legacy(controller, path, suffix, fs);
563 path_kill_slashes(*fs);
597 cc = strjoina("/sys/fs/cgroup/", dn);
606 int cg_get_path_and_check(const char *controller, const char *path, const char *suffix, char **fs) {
610 assert(fs);
617 return cg_get_path(controller, path, suffix, fs);
636 _cleanup_free_ char *fs = NULL;
641 r = cg_get_path(controller, path, NULL, &fs);
646 if (nftw(fs, trim_cb, 64, FTW_DEPTH|FTW_MOUNT|FTW_PHYS) != 0) {
656 if (rmdir(fs) < 0 && errno != ENOENT)
664 _cleanup_free_ char *fs = NULL;
667 r = cg_get_path_and_check(controller, path, NULL, &fs);
671 r = mkdir_parents(fs, 0755);
675 if (mkdir(fs, 0755) < 0) {
704 _cleanup_free_ char *fs = NULL;
711 r = cg_get_path_and_check(controller, path, "cgroup.procs", &fs);
720 return write_string_file(fs, c, 0);
756 _cleanup_free_ char *fs = NULL;
765 r = cg_get_path(controller, path, NULL, &fs);
769 return chmod_and_chown(fs, mode, uid, gid);
779 _cleanup_free_ char *fs = NULL, *procs = NULL;
790 r = cg_get_path(controller, path, "cgroup.procs", &fs);
794 r = chmod_and_chown(fs, mode, uid, gid);
815 const char *fs;
835 fs = procfs_file_alloca(pid, "cgroup");
836 f = fopen(fs, "re");
892 _cleanup_free_ char *fs = NULL, *contents = NULL;
904 r = cg_get_path(controller, NULL, "release_agent", &fs);
908 r = read_one_line_file(fs, &contents);
914 r = write_string_file(fs, agent, 0);
920 fs = mfree(fs);
921 r = cg_get_path(controller, NULL, "notify_on_release", &fs);
926 r = read_one_line_file(fs, &contents);
932 r = write_string_file(fs, "1", 0);
946 _cleanup_free_ char *fs = NULL;
955 r = cg_get_path(controller, NULL, "notify_on_release", &fs);
959 r = write_string_file(fs, "0", 0);
963 fs = mfree(fs);
965 r = cg_get_path(controller, NULL, "release_agent", &fs);
969 r = write_string_file(fs, "", 0);
1151 if (path_startswith(path, "/sys/fs/cgroup")) {
2119 struct statfs fs;
2129 if (statfs("/sys/fs/cgroup/", &fs) < 0)
2132 if (F_TYPE_EQUAL(fs.f_type, CGROUP_SUPER_MAGIC))
2134 else if (F_TYPE_EQUAL(fs.f_type, TMPFS_MAGIC))
2147 _cleanup_free_ char *fs = NULL;
2162 r = cg_get_path(SYSTEMD_CGROUP_CONTROLLER, p, "cgroup.subtree_control", &fs);
2180 r = write_string_file(fs, s, 0);
2182 log_debug_errno(r, "Failed to enable controller %s for %s (%s): %m", n, p, fs);