aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vbackup/mount-Darwin.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-07-28 17:22:01 +0000
committerrsc <devnull@localhost>2005-07-28 17:22:01 +0000
commit62a38f58da330b2a4c9ec688edf971ab417fc924 (patch)
tree0f6aaf2c41759242428ae1ed3083de8a131adbae /src/cmd/vbackup/mount-Darwin.c
parentd0cda8c42368dd1208469c7bd81749667df39a03 (diff)
downloadplan9port-62a38f58da330b2a4c9ec688edf971ab417fc924.tar.gz
plan9port-62a38f58da330b2a4c9ec688edf971ab417fc924.tar.bz2
plan9port-62a38f58da330b2a4c9ec688edf971ab417fc924.zip
darwin - variant of bsd from jeff sickel
Diffstat (limited to 'src/cmd/vbackup/mount-Darwin.c')
-rw-r--r--src/cmd/vbackup/mount-Darwin.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/cmd/vbackup/mount-Darwin.c b/src/cmd/vbackup/mount-Darwin.c
index 3dde4fdf..0cb4ce2c 100644
--- a/src/cmd/vbackup/mount-Darwin.c
+++ b/src/cmd/vbackup/mount-Darwin.c
@@ -1 +1,51 @@
-#include "mount-none.c"
+#include <u.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <sys/stat.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/syslog.h>
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+#include <rpc/pmap_prot.h>
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
+#include <nfs/nfs.h>
+#include <libc.h>
+#include "mountnfs.h"
+
+void
+mountnfs(int proto, struct sockaddr_in *sa,
+ uchar *handle, int nhandle, char *mtpt)
+{
+ int mflag;
+ struct nfs_args na;
+
+ memset(&na, 0, sizeof na);
+ na.version = NFS_ARGSVERSION;
+ na.addr = (struct sockaddr*)sa;
+ na.addrlen = sizeof *sa;
+ na.sotype = proto;
+ na.proto = (proto == SOCK_STREAM) ? IPPROTO_TCP : IPPROTO_UDP;
+ na.fh = handle;
+ na.fhsize = nhandle;
+ na.flags = NFSMNT_RESVPORT|NFSMNT_NFSV3|NFSMNT_INT;
+ na.wsize = NFS_WSIZE;
+ na.rsize = NFS_RSIZE;
+ na.readdirsize = NFS_READDIRSIZE;
+ na.timeo = 2;
+ na.retrans = NFS_RETRANS;
+ na.maxgrouplist = NFS_MAXGRPS;
+ na.readahead = 0;
+ na.deadthresh = 0;
+ na.hostname = "backup";
+ na.acregmin = 60;
+ na.acregmax = 600;
+ na.acdirmin = 60;
+ na.acdirmax = 600;
+
+ mflag = MNT_RDONLY|MNT_NOSUID|MNT_NODEV;
+ if(mount("nfs", mtpt, mflag, &na) < 0)
+ sysfatal("mount: %r");
+}