Lines Matching refs:path

42 static int fs_prepare_path_impl(const char* path, mode_t mode, uid_t uid, gid_t gid,  in fs_prepare_path_impl()  argument
52 if (TEMP_FAILURE_RETRY(lstat(path, &sb)) == -1) { in fs_prepare_path_impl()
56 ALOGE("Failed to lstat(%s): %s", path, strerror(errno)); in fs_prepare_path_impl()
64 ALOGE("Not a %s: %s", (prepare_as_dir ? "directory" : "regular file"), path); in fs_prepare_path_impl()
77 path, uid, gid, sb.st_uid, sb.st_gid); in fs_prepare_path_impl()
81 path, mode, (sb.st_mode & ALL_PERMS)); in fs_prepare_path_impl()
88 ? TEMP_FAILURE_RETRY(mkdir(path, mode)) in fs_prepare_path_impl()
89 : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY, 0644)); in fs_prepare_path_impl()
93 (prepare_as_dir ? "mkdir" : "open"), path, strerror(errno)); in fs_prepare_path_impl()
99 ALOGW("Failed to close file after create %s: %s", path, strerror(errno)); in fs_prepare_path_impl()
103 if (TEMP_FAILURE_RETRY(chmod(path, mode)) == -1) { in fs_prepare_path_impl()
104 ALOGE("Failed to chmod(%s, %d): %s", path, mode, strerror(errno)); in fs_prepare_path_impl()
107 if (TEMP_FAILURE_RETRY(chown(path, uid, gid)) == -1) { in fs_prepare_path_impl()
108 ALOGE("Failed to chown(%s, %d, %d): %s", path, uid, gid, strerror(errno)); in fs_prepare_path_impl()
115 int fs_prepare_dir(const char* path, mode_t mode, uid_t uid, gid_t gid) { in fs_prepare_dir() argument
116 return fs_prepare_path_impl(path, mode, uid, gid, /*allow_fixup*/ 1, /*prepare_as_dir*/ 1); in fs_prepare_dir()
119 int fs_prepare_dir_strict(const char* path, mode_t mode, uid_t uid, gid_t gid) { in fs_prepare_dir_strict() argument
120 return fs_prepare_path_impl(path, mode, uid, gid, /*allow_fixup*/ 0, /*prepare_as_dir*/ 1); in fs_prepare_dir_strict()
123 int fs_prepare_file_strict(const char* path, mode_t mode, uid_t uid, gid_t gid) { in fs_prepare_file_strict() argument
124 return fs_prepare_path_impl(path, mode, uid, gid, /*allow_fixup*/ 0, /*prepare_as_dir*/ 0); in fs_prepare_file_strict()
127 int fs_read_atomic_int(const char* path, int* out_value) { in fs_read_atomic_int() argument
128 int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY)); in fs_read_atomic_int()
130 ALOGE("Failed to read %s: %s", path, strerror(errno)); in fs_read_atomic_int()
136 ALOGE("Failed to read %s: %s", path, strerror(errno)); in fs_read_atomic_int()
140 ALOGE("Failed to parse %s: %s", path, strerror(errno)); in fs_read_atomic_int()
152 int fs_write_atomic_int(const char* path, int value) { in fs_write_atomic_int() argument
154 if (snprintf(temp, PATH_MAX, "%s.XXXXXX", path) >= PATH_MAX) { in fs_write_atomic_int()
180 if (rename(temp, path) == -1) { in fs_write_atomic_int()
181 ALOGE("Failed to rename %s to %s: %s", temp, path, strerror(errno)); in fs_write_atomic_int()
196 int fs_mkdirs(const char* path, mode_t mode) { in fs_mkdirs() argument
197 if (*path != '/') { in fs_mkdirs()
198 ALOGE("Relative paths are not allowed: %s", path); in fs_mkdirs()
210 char* buf = strdup(path); in fs_mkdirs()