document rump_etfs

This commit is contained in:
pooka 2010-11-30 17:32:28 +00:00
parent 205a3e1371
commit fe96301432
3 changed files with 149 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1526 2010/11/22 22:20:26 pooka Exp $
# $NetBSD: mi,v 1.1527 2010/11/30 17:32:28 pooka Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -7916,6 +7916,7 @@
./usr/share/man/cat3/rresvport_af.0 comp-c-catman .cat
./usr/share/man/cat3/rsa.0 comp-obsolete obsolete
./usr/share/man/cat3/rump.0 comp-c-catman .cat
./usr/share/man/cat3/rump_etfs.0 comp-c-catman .cat
./usr/share/man/cat3/rump_lwproc.0 comp-c-catman .cat
./usr/share/man/cat3/rumpuser.0 comp-c-catman .cat
./usr/share/man/cat3/ruserok.0 comp-c-catman .cat
@ -13819,6 +13820,7 @@
./usr/share/man/html3/rresvport.html comp-c-htmlman html
./usr/share/man/html3/rresvport_af.html comp-c-htmlman html
./usr/share/man/html3/rump.html comp-c-htmlman html
./usr/share/man/html3/rump_etfs.html comp-c-htmlman html
./usr/share/man/html3/rump_lwproc.html comp-c-htmlman html
./usr/share/man/html3/rumpuser.html comp-c-htmlman html
./usr/share/man/html3/ruserok.html comp-c-htmlman html
@ -19730,6 +19732,7 @@
./usr/share/man/man3/rresvport_af.3 comp-c-man .man
./usr/share/man/man3/rsa.3 comp-obsolete obsolete
./usr/share/man/man3/rump.3 comp-c-man .man
./usr/share/man/man3/rump_etfs.3 comp-c-man .man
./usr/share/man/man3/rump_lwproc.3 comp-c-man .man
./usr/share/man/man3/rumpuser.3 comp-c-man .man
./usr/share/man/man3/ruserok.3 comp-c-man .man

View File

@ -1,9 +1,10 @@
# $NetBSD: Makefile,v 1.2 2009/02/12 13:20:17 lukem Exp $
# $NetBSD: Makefile,v 1.3 2010/11/30 17:32:29 pooka Exp $
#
RUMPTOP= ${.CURDIR}/../../sys/rump
LIBDPLIBS+= rump ${.CURDIR}/../librump
MAN= rump_etfs.3
WARNS= 3 # XXX: kernel isn't ready for -Wsign-compare

143
lib/librumpvfs/rump_etfs.3 Normal file
View File

@ -0,0 +1,143 @@
.\" $NetBSD: rump_etfs.3,v 1.1 2010/11/30 17:32:29 pooka Exp $
.\"
.\" Copyright (c) 2010 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 November 30, 2010
.Dt RUMP_ETFS 3
.Os
.Sh NAME
.Nm rump_etfs
.Nd rump host file system interface
.Sh LIBRARY
rump kernel (librump, \-lrump)
.Sh SYNOPSIS
.In rump/rump.h
.Ft int
.Fo etfs_register
.Fa "const char *key" "const char *hostpath" "enum rump_etfs_type ftype"
.Fc
.Ft int
.Fo etfs_register_withsize
.Fa "const char *key" "const char *hostpath" "enum rump_etfs_type ftype"
.Fa "uint64_t begin" "uint64_t end"
.Fc
.Ft int
.Fn etfs_remove "const char *key"
.Sh DESCRIPTION
The rump ExtraTerrestrial File System
.Nm ( )
is used to provide access to the host file system namespace
within a rump kernel.
.Pp
The operation is based on registered
.Fa key
values which each map to a
.Fa hostpath .
A key must be an absolute path (i.e. begin with
.Dq / ) .
Multiple leading slashes are collapsed to one (i.e.
.Dq /key
is the same as
.Dq //key ) .
The rest of the path, including slashes, is compared verbatim (i.e.
.Dq /key/path
does not match
.Dq /key//path ) .
.Pp
The
.Fa hostpath
is interpreted in host system context for the current working directory
and can be either absolute or relative.
.Pp
The
.Fa ftype
parameter specifies how etfs file will be presented and does not
have to match the host type, although some limitations apply.
Possible values are:
.Bl -tag -width RUMP_ETFS_DIR_SUBDIRSXXX
.It Dv RUMP_ETFS_REG
regular file
.It Dv RUMP_ETFS_BLK
block device.
This is often used when mapping file system images.
.It Dv RUMP_ETFS_CHR
character device
.It Dv RUMP_ETFS_DIR
directory.
This option is valid only when
.Fa hostpath
is a directory.
The immediate children of the host directory will be accessible
inside a rump kernel.
.It Dv RUMP_ETFS_DIR_SUBDIRS
directory.
This option is valid only when
.Fa hostpath
is a directory.
This option recursively applies to all subdirectories, and allows
a rump kernel to access an entire directory tree.
.El
.Pp
The interfaces are:
.Bl -tag -width xxxx
.It Fn etfs_register "key" "hostpath" "ftype"
Map
.Fa key
to a file of type
.Fa ftype
with the contents of
.Fa hostpath .
.It Fn etfs_register_withsize "key" "hostpath" "ftype" "begin" "size"
Like the above, but map only
.Fa [ begin , begin+size ]
from
.Fa hostpath .
This is useful when mapping disk images where only one partition is
relevant to the application.
.It Fn etfs_remove "key"
Remove etfs mapping for
.Fa key .
This routine may be called only if the file related to the mapping
is not in use.
.Sh EXAMPLES
Map a host image file to a mountable /dev/harddisk path using
window offsets from the disklabel.
.Bd -literal -offset indent
rump_etfs_register_withsize("/dev/harddisk", "disk.img",
RUMP_ETFS_BLK,
pp->p_offset << DEV_BSHIFT, pp->p_size << DEV_BSHIFT);
.Ed
.Pp
Make the host kernel module directory hierarchy available within the
rump kernel.
.Bd -literal -offset indent
rump_etfs_register("/stand/i386/5.99.41",
"/stand/i386/5.99.41", RUMP_ETFS_DIR_SUBDIRS);
.Ed
.Sh SEE ALSO
.Xr rump 3
.Sh HISTORY
.Nm
first appeared in
.Nx 6.0 .