Lines Matching refs:fs

69 struct fs {  struct
88 static struct fs fs__entries[] = { argument
111 static bool fs__read_mounts(struct fs *fs) in fs__read_mounts() argument
123 fs->path, type) == 2) { in fs__read_mounts()
125 if (strcmp(type, fs->name) == 0) in fs__read_mounts()
130 return fs->found = found; in fs__read_mounts()
133 static int fs__valid_mount(const char *fs, long magic) in fs__valid_mount() argument
137 if (statfs(fs, &st_fs) < 0) in fs__valid_mount()
145 static bool fs__check_mounts(struct fs *fs) in fs__check_mounts() argument
149 ptr = fs->mounts; in fs__check_mounts()
151 if (fs__valid_mount(*ptr, fs->magic) == 0) { in fs__check_mounts()
152 fs->found = true; in fs__check_mounts()
153 strcpy(fs->path, *ptr); in fs__check_mounts()
176 static bool fs__env_override(struct fs *fs) in fs__env_override() argument
179 size_t name_len = strlen(fs->name); in fs__env_override()
182 memcpy(upper_name, fs->name, name_len); in fs__env_override()
190 fs->found = true; in fs__env_override()
191 strncpy(fs->path, override_path, sizeof(fs->path)); in fs__env_override()
195 static const char *fs__get_mountpoint(struct fs *fs) in fs__get_mountpoint() argument
197 if (fs__env_override(fs)) in fs__get_mountpoint()
198 return fs->path; in fs__get_mountpoint()
200 if (fs__check_mounts(fs)) in fs__get_mountpoint()
201 return fs->path; in fs__get_mountpoint()
203 if (fs__read_mounts(fs)) in fs__get_mountpoint()
204 return fs->path; in fs__get_mountpoint()
211 struct fs *fs = &fs__entries[idx]; in fs__mountpoint() local
213 if (fs->found) in fs__mountpoint()
214 return (const char *)fs->path; in fs__mountpoint()
216 return fs__get_mountpoint(fs); in fs__mountpoint()
219 static const char *mount_overload(struct fs *fs) in mount_overload() argument
221 size_t name_len = strlen(fs->name); in mount_overload()
225 snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name); in mount_overload()
228 return getenv(upper_name) ?: *fs->mounts; in mount_overload()
233 struct fs *fs = &fs__entries[idx]; in fs__mount() local
237 return (const char *)fs->path; in fs__mount()
239 mountpoint = mount_overload(fs); in fs__mount()
241 if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0) in fs__mount()
244 return fs__check_mounts(fs) ? fs->path : NULL; in fs__mount()