$NetBSD: patch-as,v 1.2 2008/08/31 06:36:48 scottr Exp $

--- lib/include/mntinfo.h.orig	2008-08-08 02:01:52.000000000 -0500
+++ lib/include/mntinfo.h
@@ -34,7 +34,7 @@
 # include <limits.h>
 #elif defined(__linux__)
 # include <mntent.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
 # include <sys/mount.h>
 #endif
 #include "posix.h"
@@ -106,17 +106,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 *
-# define MNTINFO                        struct statfs
-# define DECLARE_MNTINFO(name)          struct statfs __ ## name; \
+# 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 +165,11 @@ struct mntHandle {
 # define MNTINFO_NAME(mnt)              mnt->f_mntfromname
 # define MNTINFO_FSTYPE(mnt)            mnt->f_fstypename
 # define MNTINFO_MNTPT(mnt)             mnt->f_mntonname
-# define MNTINFO_MNT_IS_RO(mnt)         ((mnt)->f_flags & MNT_RDONLY)
+# 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
