Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/fs Add NFS service suitable for use in testing.
details: https://anonhg.NetBSD.org/src/rev/25e0165a0d6a
branches: trunk
changeset: 756620:25e0165a0d6a
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Jul 26 15:53:00 2010 +0000
description:
Add NFS service suitable for use in testing.
diffstat:
tests/fs/Makefile | 4 +-
tests/fs/nfs/Makefile | 6 +
tests/fs/nfs/nfsservice/Makefile | 36 +
tests/fs/nfs/nfsservice/README | 16 +
tests/fs/nfs/nfsservice/exports | 11 +
tests/fs/nfs/nfsservice/getmntinfo.c | 85 +
tests/fs/nfs/nfsservice/mountd.c | 2541 ++++++++++++++++++++++++
tests/fs/nfs/nfsservice/nfsd.c | 567 +++++
tests/fs/nfs/nfsservice/pathnames.h | 37 +
tests/fs/nfs/nfsservice/rpcbind/Makefile.inc | 17 +
tests/fs/nfs/nfsservice/rpcbind/check_bound.c | 231 ++
tests/fs/nfs/nfsservice/rpcbind/pmap_svc.c | 367 +++
tests/fs/nfs/nfsservice/rpcbind/rpcb_stat.c | 206 +
tests/fs/nfs/nfsservice/rpcbind/rpcb_svc.c | 232 ++
tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_4.c | 456 ++++
tests/fs/nfs/nfsservice/rpcbind/rpcb_svc_com.c | 1460 +++++++++++++
tests/fs/nfs/nfsservice/rpcbind/rpcbind.8 | 127 +
tests/fs/nfs/nfsservice/rpcbind/rpcbind.c | 613 +++++
tests/fs/nfs/nfsservice/rpcbind/rpcbind.h | 146 +
tests/fs/nfs/nfsservice/rpcbind/security.c | 282 ++
tests/fs/nfs/nfsservice/rpcbind/util.c | 401 +++
tests/fs/nfs/nfsservice/rumpnfsd.c | 154 +
22 files changed, 7993 insertions(+), 2 deletions(-)
diffs (truncated from 8091 to 300 lines):
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/Makefile
--- a/tests/fs/Makefile Mon Jul 26 15:41:33 2010 +0000
+++ b/tests/fs/Makefile Mon Jul 26 15:53:00 2010 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.17 2010/07/20 15:09:32 pooka Exp $
+# $NetBSD: Makefile,v 1.18 2010/07/26 15:53:00 pooka Exp $
.include <bsd.own.mk>
TESTSDIR= ${TESTSBASE}/fs
-SUBDIR+= common .WAIT
+SUBDIR+= common .WAIT nfs
TESTS_SUBDIRS+= ffs kernfs lfs msdosfs nullfs psshfs ptyfs puffs
TESTS_SUBDIRS+= tmpfs umapfs union
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/Makefile Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,6 @@
+# $NetBSD: Makefile,v 1.1 2010/07/26 15:53:00 pooka Exp $
+#
+
+SUBDIR+= nfsservice
+
+.include <bsd.subdir.mk>
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/nfsservice/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/nfsservice/Makefile Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,36 @@
+# $NetBSD: Makefile,v 1.1 2010/07/26 15:53:00 pooka Exp $
+#
+
+NOMAN= 1
+.include <bsd.own.mk>
+
+TESTSDIR= ${TESTSBASE}/nfs/nfsservice
+ATFFILE= no
+
+VFSTESTDIR != cd ${.CURDIR}/../../common && ${PRINTOBJDIR}
+LDADD+= -L${VFSTESTDIR} -Wl,--whole-archive -lvfstest -Wl,--no-whole-archive
+
+TESTS_C=rumpnfsd
+
+SRCS.rumpnfsd= rumpnfsd.c nfsd.c mountd.c getmntinfo.c
+
+LDADD+= -lrumpfs_nfsserver -lrumpfs_nfs # NFS support
+LDADD+= -lrumpdev_disk -lrumpdev # disk devices
+LDADD+= -lrumpfs_ffs -lrumpvfs # FFS
+LDADD+= -lrumpnet_netinet -lrumpnet_net -lrumpnet_local # TCP/IP
+LDADD+= -lrumpnet_shmif # shmif
+LDADD+= -lrumpnet -lrump -lrumpuser # base
+LDADD+= -lpthread -lutil
+
+CPPFLAGS+= -DDEBUG -DMOUNT_NOMAIN -I${.CURDIR}/include -D_REENTRANT
+CPPFLAGS+= -DRUMP_SYS_NETWORKING
+#CPPFLAGS+= -DSVC_RUN_DEBUG
+CPPFLAGS+= -I${.CURDIR}/../../common/nfsrpc
+DBG=-g
+
+.include "rpcbind/Makefile.inc"
+#.include "rpc/Makefile.inc"
+
+WARNS= 2
+
+.include <bsd.test.mk>
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/nfsservice/README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/nfsservice/README Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,16 @@
+ $NetBSD: README,v 1.1 2010/07/26 15:53:00 pooka Exp $
+
+This directory contains the necessary bits to get an NFS server
+running in a rump kernel. In essence, it's:
+
+ * rpcbind
+ * mountd
+ * nfsd
+
+Additionally, you need the libc rpc code which is in
+tests/fs/common/nfsrpc.
+
+TODO: make the standard nfs userspace services usable (the challenge
+comes from rpc being in libc).
+
+questions? ==> pooka%netbsd.org@localhost
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/nfsservice/exports
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/nfsservice/exports Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: exports,v 1.1 2010/07/26 15:53:00 pooka Exp $
+#
+
+#
+# The export dir is currently hardcoded and is exposed to the
+# world, where "world" in this case means inside the rump shmif
+# IP network, i.e. not a very big world. Probably needs some
+# adjustments if we want to test NFS features more carefully,
+# but this is enough for the current VFS level tests.
+#
+/myexport -noresvport -noresvmnt -maproot=0:0
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/nfsservice/getmntinfo.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/nfsservice/getmntinfo.c Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,85 @@
+/* $NetBSD: getmntinfo.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: getmntinfo.c,v 1.1 2010/07/26 15:53:00 pooka Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#define getvfsstat(a,b,c) rump_sys_getvfsstat(a,b,c)
+
+/*
+ * Return information about mounted filesystems.
+ */
+int
+getmntinfo(mntbufp, flags)
+ struct statvfs **mntbufp;
+ int flags;
+{
+ static struct statvfs *mntbuf;
+ static int mntsize;
+ static size_t bufsize;
+
+ _DIAGASSERT(mntbufp != NULL);
+
+ if (mntsize <= 0 &&
+ (mntsize = getvfsstat(NULL, (size_t)0, MNT_NOWAIT)) == -1)
+ return (0);
+ if (bufsize > 0 &&
+ (mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
+ return (0);
+ while (bufsize <= mntsize * sizeof(struct statvfs)) {
+ if (mntbuf)
+ free(mntbuf);
+ bufsize = (mntsize + 1) * sizeof(struct statvfs);
+ if ((mntbuf = malloc(bufsize)) == NULL)
+ return (0);
+ if ((mntsize = getvfsstat(mntbuf, bufsize, flags)) == -1)
+ return (0);
+ }
+ *mntbufp = mntbuf;
+ return (mntsize);
+}
diff -r 6242099462a8 -r 25e0165a0d6a tests/fs/nfs/nfsservice/mountd.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/fs/nfs/nfsservice/mountd.c Mon Jul 26 15:53:00 2010 +0000
@@ -0,0 +1,2541 @@
+/* $NetBSD: mountd.c,v 1.1 2010/07/26 15:53:00 pooka Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Herb Hasler and Rick Macklem at The University of Guelph.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#ifndef lint
+__COPYRIGHT("@(#) Copyright (c) 1989, 1993\
+ The Regents of the University of California. All rights reserved.");
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
+#else
+__RCSID("$NetBSD: mountd.c,v 1.1 2010/07/26 15:53:00 pooka Exp $");
+#endif
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <syslog.h>
+#include <sys/ucred.h>
+
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+#include <rpc/pmap_prot.h>
+#include <rpcsvc/mount.h>
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
+#include <nfs/nfs.h>
+#include <nfs/nfsmount.h>
+
+#include <arpa/inet.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <grp.h>
+#include <netdb.h>
+#include <pwd.h>
+#include <netgroup.h>
+#include <semaphore.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <err.h>
+#include <util.h>
+#include "pathnames.h"
+
+#ifdef IPSEC
+#include <netinet6/ipsec.h>
+#ifndef IPSEC_POLICY_IPSEC /* no ipsec support on old ipsec */
+#undef IPSEC
+#endif
+#include "ipsec.h"
+#endif
+
+#include "svc_fdset.h"
+
+#include <stdarg.h>
+
+/*
+ * Structures for keeping the mount list and export list
+ */
+struct mountlist {
+ struct mountlist *ml_next;
+ char ml_host[RPCMNT_NAMELEN + 1];
+ char ml_dirp[RPCMNT_PATHLEN + 1];
Home |
Main Index |
Thread Index |
Old Index