summaryrefslogtreecommitdiff
path: root/sysutils/open-vm-tools/patches/patch-as
blob: f226880c40fe1444bedecd7ef29f002db29ac45c (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
$NetBSD: patch-as,v 1.3 2016/10/09 03:41:56 ryoon Exp $

--- lib/include/mntinfo.h.orig	2016-02-16 20:06:46.000000000 +0000
+++ lib/include/mntinfo.h
@@ -34,8 +34,11 @@
 # include <limits.h>
 #elif defined(__linux__)
 # include <mntent.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
 # include <sys/mount.h>
+#if defined(__NetBSD__)
+# include <fstab.h>
+#endif
 #endif
 #include "posix.h"
 
@@ -106,17 +109,27 @@
 # define MNTINFO_FSTYPE(mnt)            mnt->mnt_type
 # define MNTINFO_MNTPT(mnt)             mnt->mnt_dir
 # define MNTINFO_MNT_IS_RO(mnt)         (hasmntopt((mnt), "rw") == NULL)
-#elif defined(__FreeBSD__) || defined(__APPLE__)
+#elif defined(__FreeBSD__) || defined(__APPLE__) || defined(__NetBSD__)
 struct mntHandle {
+#if defined(__NetBSD__)
+   struct statvfs *mountPoints;  // array of mountpoints per getmntinfo(3)
+#else
    struct statfs *mountPoints;  // array of mountpoints per getmntinfo(3)
+#endif
    int numMountPoints;          // number of elements in mntArray
    int mountIndex;              // current location within mountPoints array
 };
 # define MNTFILE                        _PATH_FSTAB
 # define MNTHANDLE                      struct mntHandle *
+#if defined(__NetBSD__)
+# define MNTINFO                        struct statvfs
+# define DECLARE_MNTINFO(name)          struct statvfs __ ## name; \
+                                        struct statvfs *name = &__ ## name
+#else
 # define MNTINFO                        struct statfs
 # define DECLARE_MNTINFO(name)          struct statfs __ ## name; \
                                         struct statfs *name = &__ ## name
+#endif
 
 # define OPEN_MNTFILE(mode)                                             \
 ({                                                                      \
@@ -155,7 +168,11 @@ struct mntHandle {
 # define MNTINFO_NAME(mnt)              mnt->f_mntfromname
 # define MNTINFO_FSTYPE(mnt)            mnt->f_fstypename
 # define MNTINFO_MNTPT(mnt)             mnt->f_mntonname
+#if defined(__NetBSD__)
+# define MNTINFO_MNT_IS_RO(mnt)         ((mnt)->f_flag & MNT_RDONLY)
+#else
 # define MNTINFO_MNT_IS_RO(mnt)         ((mnt)->f_flags & MNT_RDONLY)
+#endif
 #else
 # error "Define mount information macros for your OS type"
 #endif