$NetBSD: patch-ab,v 1.6 2006/02/02 15:03:19 joerg Exp $

--- plpnfsd/mp_mount.c.orig	2002-07-12 14:45:41.000000000 +0000
+++ plpnfsd/mp_mount.c
@@ -21,7 +21,7 @@ extern int inet_addr(char *);
 #define PORTMAP			/* I need svcudp_create in rpc/svc_soc.h, sol 2.4 */
 #endif
 
-#include <OSdefs.h>
+#include "OSdefs.h"
 #include <stdio.h>
 #include <signal.h>
 #include <sys/stat.h>
@@ -31,7 +31,7 @@ extern int inet_addr(char *);
 #include <bstring.h>
 #endif
 
-#if defined(__NetBSD__) || defined(__FreeBSD__)
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/param.h>		/* Needs NGROUPS for mount.h */
 #define umount(dir) unmount(dir, 1)
 #endif
@@ -47,22 +47,33 @@ extern int inet_addr(char *);
 static char nfshost[128];
 
 #define NFSCLIENT
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #define NFS
 #endif				/* __FreeBSD__ */
 #include <sys/mount.h>
 
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__DragonFly__)
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <rpc/rpc.h>
 #include <nfs/rpcv2.h>
-#if __FreeBSD_version >= 300001
+#if defined(__DragonFly__) || __FreeBSD_version >= 300001
 #include <nfs/nfs.h>
 #endif
 #endif				/* __FreeBSD__ */
 
+#ifdef __NetBSD__
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <strings.h>
+#include <nfs/nfsmount.h>
+#endif /* __NetBSD__ */
+
 #include <rpc/rpc.h>
 #include "nfs_prot.h"
 
@@ -156,7 +167,7 @@ static void doexit() {
 	struct mntent *ent;
 #endif
 #endif
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)
 	struct stat statb;
 #endif
 
@@ -277,7 +288,7 @@ mount_and_run(char *dir, void (*proc)(),
 #else
 	struct nfs_args nfs_args;
 #endif
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
 	int mount_flags;
 #endif
 
@@ -427,8 +438,8 @@ mount_and_run(char *dir, void (*proc)(),
 	    NFSMNT_RETRANS | NFSMNT_TIMEO | NFSMNT_WSIZE | NFSMNT_RSIZE;
 #endif
 
-#ifdef __FreeBSD__
-#if __FreeBSD_version >= 300001
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__DragonFly__) || __FreeBSD_version >= 300001
 	nfs_args.version = NFS_ARGSVERSION;
 #endif
 	nfs_args.addr = (struct sockaddr *) &sain;
@@ -453,20 +464,23 @@ mount_and_run(char *dir, void (*proc)(),
 #endif
 
 #ifdef __NetBSD__
+	nfs_args.version = NFS_ARGSVERSION;
 	nfs_args.addrlen = sizeof(sain);
 	nfs_args.sotype = SOCK_DGRAM;
 	nfs_args.maxgrouplist = NGROUPS;
 	nfs_args.readahead = 1;
 	nfs_args.addr = (struct sockaddr *) &sain;
 	nfs_args.fh = (void *) root_fh;
+	nfs_args.fhsize = sizeof(*root_fh);
 	nfs_args.wsize = PBUFSIZE;
 	nfs_args.rsize = PBUFSIZE;
 	nfs_args.retrans = 10;
 	nfs_args.timeo = 600;
 	nfs_args.hostname = PSIONHOSTNAME;
 	nfs_args.flags = NFSMNT_INT | NFSMNT_RETRANS | NFSMNT_TIMEO
-	    | NFSMNT_NOCONN | NFSMNT_DUMBTIMR | NFSMNT_MYWRITE
+	    | NFSMNT_NOCONN | NFSMNT_DUMBTIMR
 	    | NFSMNT_WSIZE | NFSMNT_RSIZE;
+	mount_flags = MNT_NOSUID | MNT_NODEV | MNT_NOEXEC | MNT_NOATIME;
 #endif
 
 #if defined(_IBMR2)
@@ -496,7 +510,7 @@ mount_and_run(char *dir, void (*proc)(),
 #if defined(__sgi) || (defined(sun) && defined(__SVR4))
 			if (mount("", dir, MS_DATA, "nfs", &nfs_args, sizeof(nfs_args)))
 #endif
-#if defined(__NetBSD__) || defined(__NeXT__)
+#if defined(__NeXT__)
 			if (mount(MOUNT_NFS, dir, 0, (caddr_t) & nfs_args))
 #endif
 #ifdef hpux
@@ -512,8 +526,8 @@ mount_and_run(char *dir, void (*proc)(),
 			if (aix3_mount("psion:loc", dir, 0, MOUNT_TYPE_NFS, &nfs_args, "plpnfsd"))
 #endif
 
-#ifdef __FreeBSD__
-#if __FreeBSD_version >= 300001
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__DragonFly__) || __FreeBSD_version >= 300001
 			if (mount("nfs", dir, mount_flags, &nfs_args))
 #else
 			if (mount(MOUNT_NFS, dir, mount_flags, &nfs_args))
