Lines Matching refs:fs
88 struct fs { struct
109 static struct fs fs__entries[] = { argument
142 static bool fs__read_mounts(struct fs *fs) in fs__read_mounts() argument
154 fs->path, type) == 2) { in fs__read_mounts()
156 if (strcmp(type, fs->name) == 0) in fs__read_mounts()
161 return fs->found = found; in fs__read_mounts()
164 static int fs__valid_mount(const char *fs, long magic) in fs__valid_mount() argument
168 if (statfs(fs, &st_fs) < 0) in fs__valid_mount()
176 static bool fs__check_mounts(struct fs *fs) in fs__check_mounts() argument
180 ptr = fs->mounts; in fs__check_mounts()
182 if (fs__valid_mount(*ptr, fs->magic) == 0) { in fs__check_mounts()
183 fs->found = true; in fs__check_mounts()
184 strcpy(fs->path, *ptr); in fs__check_mounts()
207 static bool fs__env_override(struct fs *fs) in fs__env_override() argument
210 size_t name_len = strlen(fs->name); in fs__env_override()
213 memcpy(upper_name, fs->name, name_len); in fs__env_override()
221 fs->found = true; in fs__env_override()
222 strncpy(fs->path, override_path, sizeof(fs->path)); in fs__env_override()
226 static const char *fs__get_mountpoint(struct fs *fs) in fs__get_mountpoint() argument
228 if (fs__env_override(fs)) in fs__get_mountpoint()
229 return fs->path; in fs__get_mountpoint()
231 if (fs__check_mounts(fs)) in fs__get_mountpoint()
232 return fs->path; in fs__get_mountpoint()
234 if (fs__read_mounts(fs)) in fs__get_mountpoint()
235 return fs->path; in fs__get_mountpoint()
242 struct fs *fs = &fs__entries[idx]; in fs__mountpoint() local
244 if (fs->found) in fs__mountpoint()
245 return (const char *)fs->path; in fs__mountpoint()
247 return fs__get_mountpoint(fs); in fs__mountpoint()
250 static const char *mount_overload(struct fs *fs) in mount_overload() argument
252 size_t name_len = strlen(fs->name); in mount_overload()
256 snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); in mount_overload()
259 return getenv(upper_name) ?: *fs->mounts; in mount_overload()
264 struct fs *fs = &fs__entries[idx]; in fs__mount() local
268 return (const char *)fs->path; in fs__mount()
270 mountpoint = mount_overload(fs); in fs__mount()
272 if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) in fs__mount()
275 return fs__check_mounts(fs) ? fs->path : NULL; in fs__mount()