Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add the ability to mount NFS filesystems in COMPAT_NETBSD32
details: https://anonhg.NetBSD.org/src/rev/0f95d51c3e86
branches: trunk
changeset: 761290:0f95d51c3e86
user: matt <matt%NetBSD.org@localhost>
date: Sat Jan 22 22:26:10 2011 +0000
description:
Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.
diffstat:
sys/compat/netbsd32/netbsd32.h | 24 ++++++++++++++-
sys/compat/netbsd32/netbsd32_fs.c | 60 +++++++++++++++++++++++++++++++++++++-
sys/nfs/nfsmount.h | 7 ++-
3 files changed, 85 insertions(+), 6 deletions(-)
diffs (173 lines):
diff -r e2dff5acebb1 -r 0f95d51c3e86 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h Sat Jan 22 21:09:51 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32.h Sat Jan 22 22:26:10 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.84 2009/12/14 00:47:11 matt Exp $ */
+/* $NetBSD: netbsd32.h,v 1.85 2011/01/22 22:26:10 matt Exp $ */
/*
* Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -844,6 +844,28 @@
netbsd32_u_long size;
};
+/* from <nfs/nfsmount,h> */
+struct netbsd32_nfs_args {
+ int32_t version; /* args structure version number */
+ netbsd32_sockaddrp_t addr; /* file server address */
+ int32_t addrlen; /* length of address */
+ int32_t sotype; /* Socket type */
+ int32_t proto; /* and Protocol */
+ netbsd32_u_charp fh; /* File handle to be mounted */
+ int32_t fhsize; /* Size, in bytes, of fh */
+ int32_t flags; /* flags */
+ int32_t wsize; /* write size in bytes */
+ int32_t rsize; /* read size in bytes */
+ int32_t readdirsize; /* readdir size in bytes */
+ int32_t timeo; /* initial timeout in .1 secs */
+ int32_t retrans; /* times to retry send */
+ int32_t maxgrouplist; /* Max. size of group list */
+ int32_t readahead; /* # of blocks to readahead */
+ int32_t leaseterm; /* Ignored; Term (sec) of lease */
+ int32_t deadthresh; /* Retrans threshold */
+ netbsd32_charp hostname; /* server's name */
+};
+
#if 0
int netbsd32_kevent(struct lwp *, void *, register_t *);
#endif
diff -r e2dff5acebb1 -r 0f95d51c3e86 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Sat Jan 22 21:09:51 2011 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Sat Jan 22 22:26:10 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_fs.c,v 1.59 2010/04/23 15:19:20 rmind Exp $ */
+/* $NetBSD: netbsd32_fs.c,v 1.60 2011/01/22 22:26:10 matt Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.59 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.60 2011/01/22 22:26:10 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -52,6 +52,9 @@
#include <fs/cd9660/cd9660_mount.h>
#include <ufs/ufs/ufsmount.h>
+#define NFS_ARGS_ONLY
+#include <nfs/nfsmount.h>
+
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
@@ -770,11 +773,13 @@
struct netbsd32_ufs_args ufs_args;
struct netbsd32_mfs_args mfs_args;
struct netbsd32_iso_args iso_args;
+ struct netbsd32_nfs_args nfs_args;
} fs_args32;
union {
struct ufs_args ufs_args;
struct mfs_args mfs_args;
struct iso_args iso_args;
+ struct nfs_args nfs_args;
} fs_args;
const char *type = SCARG_P32(uap, type);
const char *path = SCARG_P32(uap, path);
@@ -838,6 +843,33 @@
data_seg = UIO_SYSSPACE;
data = &fs_args.iso_args;
data_len = sizeof(fs_args.iso_args);
+ } else if (strcmp(mtype, MOUNT_NFS) == 0) {
+ if (data_len != sizeof(fs_args32.nfs_args))
+ return EINVAL;
+ if ((flags & MNT_GETARGS) == 0) {
+ error = copyin(data, &fs_args32.nfs_args,
+ sizeof(fs_args32.nfs_args));
+ if (error)
+ return error;
+ fs_args.nfs_args.version = fs_args32.nfs_args.version;
+ fs_args.nfs_args.addr =
+ NETBSD32PTR64(fs_args32.nfs_args.addr);
+ memcpy(&fs_args.nfs_args.addrlen,
+ &fs_args32.nfs_args.addrlen,
+ offsetof(struct nfs_args, fh)
+ - offsetof(struct nfs_args, addrlen));
+ fs_args.nfs_args.fh =
+ NETBSD32PTR64(fs_args32.nfs_args.fh);
+ memcpy(&fs_args.nfs_args.fhsize,
+ &fs_args32.nfs_args.fhsize,
+ offsetof(struct nfs_args, hostname)
+ - offsetof(struct nfs_args, fhsize));
+ fs_args.nfs_args.hostname =
+ NETBSD32PTR64(fs_args32.nfs_args.hostname);
+ }
+ data_seg = UIO_SYSSPACE;
+ data = &fs_args.nfs_args;
+ data_len = sizeof(fs_args.nfs_args);
} else {
data_seg = UIO_USERSPACE;
}
@@ -876,6 +908,30 @@
fs_args32.iso_args.flags = fs_args.iso_args.flags;
error = copyout(&fs_args32.iso_args, data,
sizeof(fs_args32.iso_args));
+ } else if (strcmp(mtype, MOUNT_NFS) == 0) {
+ if (data_len != sizeof(fs_args.nfs_args))
+ return EINVAL;
+ error = copyin(data, &fs_args32.nfs_args,
+ sizeof(fs_args32.nfs_args));
+ if (error)
+ return error;
+ fs_args.nfs_args.version = fs_args32.nfs_args.version;
+ NETBSD32PTR32(fs_args32.nfs_args.addr,
+ fs_args.nfs_args.addr);
+ memcpy(&fs_args32.nfs_args.addrlen,
+ &fs_args.nfs_args.addrlen,
+ offsetof(struct nfs_args, fh)
+ - offsetof(struct nfs_args, addrlen));
+ NETBSD32PTR32(fs_args32.nfs_args.fh,
+ fs_args.nfs_args.fh);
+ memcpy(&fs_args32.nfs_args.fhsize,
+ &fs_args.nfs_args.fhsize,
+ offsetof(struct nfs_args, hostname)
+ - offsetof(struct nfs_args, fhsize));
+ NETBSD32PTR32(fs_args32.nfs_args.hostname,
+ fs_args.nfs_args.hostname);
+ error = copyout(&fs_args32.nfs_args, data,
+ sizeof(fs_args32.nfs_args));
}
}
return error;
diff -r e2dff5acebb1 -r 0f95d51c3e86 sys/nfs/nfsmount.h
--- a/sys/nfs/nfsmount.h Sat Jan 22 21:09:51 2011 +0000
+++ b/sys/nfs/nfsmount.h Sat Jan 22 22:26:10 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfsmount.h,v 1.50 2010/09/25 01:42:39 matt Exp $ */
+/* $NetBSD: nfsmount.h,v 1.51 2011/01/22 22:26:10 matt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,8 @@
#ifndef _NFS_NFSMOUNT_H_
#define _NFS_NFSMOUNT_H_
-#ifdef _KERNEL
+
+#if defined(_KERNEL) && !defined(NFS_ARGS_ONLY)
#include <sys/condvar.h>
#include <sys/rwlock.h>
#include <sys/mutex.h>
@@ -121,7 +122,7 @@
#define NFSMNT_STALEWRITEVERF 0x00008000 /* Write verifier is changing */
#define NFSMNT_WCCKLUDGE 0x00010000 /* see nfs_check_wccdata() */
-#ifdef _KERNEL
+#if defined(_KERNEL) && !defined(NFS_ARGS_ONLY)
/*
* Mount structure.
* One allocated on every NFS mount.
Home |
Main Index |
Thread Index |
Old Index