Lines Matching refs:fs

88 struct fs {  struct
110 static struct fs fs__entries[] = { argument
149 static bool fs__read_mounts(struct fs *fs) in fs__read_mounts() argument
161 fs->path, type) == 2) { in fs__read_mounts()
163 if (strcmp(type, fs->name) == 0) in fs__read_mounts()
168 fs->checked = true; in fs__read_mounts()
169 return fs->found = found; in fs__read_mounts()
172 static int fs__valid_mount(const char *fs, long magic) in fs__valid_mount() argument
176 if (statfs(fs, &st_fs) < 0) in fs__valid_mount()
184 static bool fs__check_mounts(struct fs *fs) in fs__check_mounts() argument
188 ptr = fs->mounts; in fs__check_mounts()
190 if (fs__valid_mount(*ptr, fs->magic) == 0) { in fs__check_mounts()
191 fs->found = true; in fs__check_mounts()
192 strcpy(fs->path, *ptr); in fs__check_mounts()
215 static bool fs__env_override(struct fs *fs) in fs__env_override() argument
218 size_t name_len = strlen(fs->name); in fs__env_override()
222 memcpy(upper_name, fs->name, name_len); in fs__env_override()
230 fs->found = true; in fs__env_override()
231 fs->checked = true; in fs__env_override()
232 strncpy(fs->path, override_path, sizeof(fs->path) - 1); in fs__env_override()
233 fs->path[sizeof(fs->path) - 1] = '\0'; in fs__env_override()
237 static const char *fs__get_mountpoint(struct fs *fs) in fs__get_mountpoint() argument
239 if (fs__env_override(fs)) in fs__get_mountpoint()
240 return fs->path; in fs__get_mountpoint()
242 if (fs__check_mounts(fs)) in fs__get_mountpoint()
243 return fs->path; in fs__get_mountpoint()
245 if (fs__read_mounts(fs)) in fs__get_mountpoint()
246 return fs->path; in fs__get_mountpoint()
253 struct fs *fs = &fs__entries[idx]; in fs__mountpoint() local
255 if (fs->found) in fs__mountpoint()
256 return (const char *)fs->path; in fs__mountpoint()
263 if (fs->checked) in fs__mountpoint()
266 return fs__get_mountpoint(fs); in fs__mountpoint()
269 static const char *mount_overload(struct fs *fs) in mount_overload() argument
271 size_t name_len = strlen(fs->name); in mount_overload()
275 snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); in mount_overload()
278 return getenv(upper_name) ?: *fs->mounts; in mount_overload()
283 struct fs *fs = &fs__entries[idx]; in fs__mount() local
287 return (const char *)fs->path; in fs__mount()
289 mountpoint = mount_overload(fs); in fs__mount()
291 if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) in fs__mount()
294 return fs__check_mounts(fs) ? fs->path : NULL; in fs__mount()