Add & enable rump_nfs.

This commit is contained in:
pooka 2008-10-16 09:30:57 +00:00
parent 37b61acf1e
commit d72ee403e1
4 changed files with 169 additions and 2 deletions

View File

@ -1,8 +1,9 @@
# $NetBSD: Makefile,v 1.7 2008/09/04 16:16:32 pooka Exp $
# $NetBSD: Makefile,v 1.8 2008/10/16 09:30:57 pooka Exp $
SUBDIR= mount_9p mount_portal mount_psshfs mount_sysctlfs
SUBDIR+=rump_cd9660 rump_efs rump_ext2fs rump_ffs rump_hfs rump_lfs
SUBDIR+=rump_msdos rump_ntfs rump_syspuffs rump_sysvbfs rump_tmpfs rump_udf
SUBDIR+=rump_msdos rump_nfs rump_ntfs rump_syspuffs rump_sysvbfs
SUBDIR+=rump_tmpfs rump_udf
.include <bsd.subdir.mk>

View File

@ -0,0 +1,20 @@
# $NetBSD: Makefile,v 1.1 2008/10/16 09:30:57 pooka Exp $
#
MOUNTNAME= nfs
SRCS+= getnfsargs.c
# One or the other of the following. Compile-time selection for now.
# The first one uses host sockets to provide a networking stack, the
# second one runs the real NetBSD kernel networking stack in userspace
# and uses /dev/tap to access the network.
#
LDADD+= -lrumpfs_nfs -lrumpnet -lrumpnet_sockin
#LDADD+= -lrumpfs_nfs -lrumpnet -lrumpnet_net -lrumpnet_netinet \
-lrumpnet_virtif
ISRUMP= # gives me nightmares
#CPPFLAGS+= -DINET6 # for getnfsargs?
.include <bsd.prog.mk>

View File

@ -0,0 +1,88 @@
.\" $NetBSD: rump_nfs.8,v 1.1 2008/10/16 09:30:57 pooka Exp $
.\"
.\" WARNING: GENERATED FILE, DO NOT EDIT
.\" INSTEAD, EDIT makerumpmanpages.sh AND REGEN
.\"
.\" Copyright (c) 2008 Antti Kantee. 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.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
.\"
.Dd August 6, 2008
.Dt RUMP_NFS 8
.Os
.Sh NAME
.Nm rump_nfs
.Nd mount the nfs file system using a userspace server
.Sh SYNOPSIS
.Cd "file-system PUFFS"
.Pp
.Nm
.Op options
.Ar special
.Ar node
.Sh DESCRIPTION
The
.Nm
utility can be used to mount nfs file systems.
It uses
.Xr rump 3
and
.Xr p2k 3
to facilitate running the file system as a server in userspace.
As opposed to
.Xr mount_nfs 8 ,
.Nm
does not use file system code within the kernel and therefore does
not require kernel support except
.Xr puffs 4 .
Apart from a minor speed penalty (~10%), there is no difference to
using the in-kernel code.
.Pp
It is recommended that untrusted file system images be mounted with
.Nm
instead of
.Xr mount_nfs 8 .
Corrupt file system images commonly cause the file system
to crash the entire kernel, but with
.Nm
only the userspace server process will dump core.
.Pp
Please see
.Xr mount_nfs 8
for a full description of the available command line options.
.Sh SEE ALSO
.Xr p2k 3 ,
.Xr puffs 3 ,
.Xr rump 3 ,
.Xr mount_nfs 8
.Sh HISTORY
The
.Nm
utility first appeared in
.Nx 5.0 .
.Sh BUGS
.Nm
cannot be used via
.Xr mount 8 .
Instead,
.Nm
must be run directly.

View File

@ -0,0 +1,58 @@
/* $NetBSD: rump_nfs.c,v 1.1 2008/10/16 09:30:57 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/types.h>
#include <sys/mount.h>
#include <nfs/nfsmount.h>
#include <rump/p2k.h>
#include <err.h>
#include <puffs.h>
#include <stdlib.h>
#include <string.h>
#include "mount_nfs.h"
int
main(int argc, char *argv[])
{
struct nfs_args args;
char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
int rv, mntflags;
setprogname(argv[0]);
mount_nfs_parseargs(argc, argv, &args, &mntflags, canon_dev, canon_dir);
rv = p2k_run_fs(MOUNT_NFS, canon_dev, canon_dir, mntflags, &args,
sizeof(args), PUFFS_FLAG_OPDUMP);
if (rv == -1)
err(1, "mount");
return 0;
}