2 #include <sys/socket.h>
6 # include <linux/nfs.h>
9 # include <linux/nfs.h>
11 #include <linux/nfs2.h>
12 #include <linux/nfs_mount.h>
17 mountnfs(int proto, struct sockaddr_in *sa, uchar *handle, int nhandle, char *mtpt)
20 struct nfs_mount_data nfs;
22 fd = socket(AF_INET, proto, proto==SOCK_STREAM ? IPPROTO_TCP : IPPROTO_UDP);
24 sysfatal("socket: %r");
26 memset(&nfs, 0, sizeof nfs);
27 nfs.version = NFS_MOUNT_VERSION;
36 if(proto==SOCK_STREAM)
37 nfs.flags |= NFS_MOUNT_TCP;
47 strcpy(nfs.hostname, "backup");
50 memcpy(nfs.root.data, handle, nhandle);
51 nfs.root.size = nhandle;
52 mflag = MS_NOATIME|MS_NODEV|MS_NODIRATIME|
53 MS_NOEXEC|MS_NOSUID|MS_RDONLY;
55 if(mount("backup:/", mtpt, "nfs", mflag, &nfs) < 0)
56 sysfatal("mount: %r");