10 /* verify that a mountpoint is actually the type we want */
12 int valid_mountpoint(const char *mount, long magic)
16 if (statfs(mount, &st_fs) < 0)
18 else if ((long)st_fs.f_type != magic)
24 /* find the path to a mounted file system */
25 const char *find_mountpoint(const char *fstype, long magic,
26 char *mountpoint, int len,
27 const char * const *known_mountpoints)
29 const char * const *ptr;
34 if (known_mountpoints) {
35 ptr = known_mountpoints;
37 if (valid_mountpoint(*ptr, magic) == 0) {
38 strncpy(mountpoint, *ptr, len - 1);
39 mountpoint[len-1] = 0;
46 /* give up and parse /proc/mounts */
47 fp = fopen("/proc/mounts", "r");
51 snprintf(format, 128, "%%*s %%%ds %%99s %%*s %%*d %%*d\n", len);
53 while (fscanf(fp, format, mountpoint, type) == 2) {
54 if (strcmp(type, fstype) == 0)
59 if (strcmp(type, fstype) != 0)