Module Name:    src
Committed By:   pooka
Date:           Fri Jul 31 19:18:46 UTC 2009

Added Files:
        src/usr.sbin/puffs/rump_fdesc: Makefile rump_fdesc.8 rump_fdesc.c

Log Message:
rump_fdesc.  it works, but it's actually not very sexy out of
developer clothes, since the server cannot fetch the fd information
from the kernel.  Therefore, don't build it by default.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.sbin/puffs/rump_fdesc/Makefile \
    src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8 \
    src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/usr.sbin/puffs/rump_fdesc/Makefile
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/Makefile:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/Makefile	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile,v 1.1 2009/07/31 19:18:46 pooka Exp $
+#
+
+MOUNTNAME=	fdesc
+
+ISRUMP=		# descualified
+
+.include <bsd.prog.mk>
Index: src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/rump_fdesc.8	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,112 @@
+.\"	$NetBSD: rump_fdesc.8,v 1.1 2009/07/31 19:18:46 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 February 15, 2009
+.Dt RUMP_FDESC 8
+.Os
+.Sh NAME
+.Nm rump_fdesc
+.Nd mount the fdesc file system using a userspace server
+.Sh SYNOPSIS
+.Cd "file-system PUFFS"
+.Cd "pseudo-device putter"
+.Pp
+.Nm
+.Op options
+.Ar special
+.Ar node
+.Sh DESCRIPTION
+The
+.Nm
+utility can be used to mount fdesc 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_fdesc 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 (starting from 10% and depending
+on the workload and file system in question), there is no difference
+to using in-kernel code.
+.Pp
+In case mounting a file system image from a regular file,
+.Nm
+does not require the use of
+.Xr vnconfig 8
+unlike kernel file systems.
+Instead, the image path can be directly passed as the special file path.
+The exception is if the image contains a disklabel.
+In this case vnconfig is required to resolve the start offset for the
+correct partition within the image.
+.Pp
+It is recommended that untrusted file system images be mounted with
+.Nm
+instead of
+.Xr mount_fdesc 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
+To use
+.Nm
+via
+.Xr mount 8 ,
+the flags
+.Fl o Ar rump
+and
+.Fl t Ar fdesc
+should be given.
+Similarly,
+.Nm
+is run instead of
+.Xr mount_fdesc 8
+if
+.Dq rump
+is added to the options field of
+.Xr fstab 5 .
+.Pp
+Please see
+.Xr mount_fdesc 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_fdesc 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Nx 5.0 .
+It is currently considered experimental.
Index: src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c
diff -u /dev/null src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c:1.1
--- /dev/null	Fri Jul 31 19:18:46 2009
+++ src/usr.sbin/puffs/rump_fdesc/rump_fdesc.c	Fri Jul 31 19:18:46 2009
@@ -0,0 +1,59 @@
+/*	$NetBSD: rump_fdesc.c,v 1.1 2009/07/31 19:18:46 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 <miscfs/fdesc/fdesc.h>
+
+#include <err.h>
+#include <puffs.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <rump/p2k.h>
+
+#include "mount_fdesc.h"
+
+int
+main(int argc, char *argv[])
+{
+	char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
+	int mntflags;
+	int rv;
+
+	setprogname(argv[0]);
+
+	mount_fdesc_parseargs(argc, argv, NULL, &mntflags,
+	    canon_dev, canon_dir);
+	rv = p2k_run_fs(MOUNT_FDESC, canon_dev, canon_dir, mntflags,
+		NULL, 0, PUFFS_KFLAG_NOCACHE_PAGE);
+	if (rv)
+		err(1, "mount");
+
+	return 0;
+}

Reply via email to