blob: 7e47122945d40ac2b2b1f828e605c20052d14fed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
$NetBSD: patch-ab,v 1.9 2007/12/02 12:55:10 wiz Exp $
--- lib/mountlist.c.orig 2007-01-26 23:16:55.000000000 +0100
+++ lib/mountlist.c
@@ -174,6 +174,11 @@
#if MOUNTED_GETMNTINFO
+# if defined(__NetBSD__) && (__NetBSD_Version__ > 299000900)
+# define statfs statvfs
+# define HAVE_F_FSTYPENAME_IN_STATFS 1
+# endif
+
# if ! HAVE_STRUCT_STATFS_F_FSTYPENAME
static char *
fstype_to_string (short int t)
@@ -296,6 +301,10 @@ fstype_to_string (int t)
}
#endif /* MOUNTED_VMOUNT */
+#ifdef __INTERIX
+# include <dirent.h>
+# include <sys/statvfs.h>
+#endif
#if defined MOUNTED_GETMNTENT1 || defined MOUNTED_GETMNTENT2
@@ -859,6 +868,50 @@ read_file_system_list (bool need_fs_type
}
#endif /* MOUNTED_VMOUNT. */
+#ifdef __INTERIX /* Interix. */
+ {
+ DIR *devfs = opendir ("/dev/fs");
+ struct dirent *de;
+ struct statvfs svfs;
+ char fsname[] = "/dev/fs/#"; /* writable */
+
+ if (devfs == NULL)
+ return NULL;
+
+ while ((de = readdir (devfs)) != NULL)
+ {
+ if (strlen (de->d_name) != 1)
+ {
+ /* "Drive letters" should all be exactly one character long. */
+ continue;
+ }
+
+ fsname[8] = de->d_name[0];
+
+ if (statvfs (fsname, &svfs) != 0)
+ {
+ /* Could be an offline network fs or empty removable; don't fail. */
+ continue;
+ }
+
+ me = xmalloc (sizeof *me);
+
+ me->me_devname = xstrdup (svfs.f_mntfromname);
+ me->me_mountdir = xstrdup (svfs.f_mntonname);
+ me->me_type = xstrdup (svfs.f_fstypename);
+ me->me_dev = (dev_t)svfs.f_fsid;
+ me->me_dummy = (svfs.f_type == ST_FSTYPE_OFS ? 1 : 0);
+ me->me_remote = ((svfs.f_type == ST_FSTYPE_SAMBA
+ || svfs.f_type == ST_FSTYPE_NFS) ? 1 : 0);
+ me->me_type_malloced = 1;
+
+ /* Add to the linked list. */
+ *mtail = me;
+ mtail = &me->me_next;
+ }
+ }
+#endif
+
*mtail = NULL;
return mount_list;
|