1#!/bin/sh
2#
3#	$NetBSD: makerumpmanpages.sh,v 1.12 2010/11/22 07:56:31 pooka Exp $
4#
5
6IFS=' '
7COPYRIGHT='.\"	WARNING: GENERATED FILE, DO NOT EDIT
8.\"	INSTEAD, EDIT makerumpmanpages.sh AND REGEN
9.\"	from: $NetBSD: makerumpmanpages.sh,v 1.12 2010/11/22 07:56:31 pooka Exp $
10.\"
11.\" Copyright (c) 2008-2010 Antti Kantee.  All rights reserved.
12.\"
13.\" Redistribution and use in source and binary forms, with or without
14.\" modification, are permitted provided that the following conditions
15.\" are met:
16.\" 1. Redistributions of source code must retain the above copyright
17.\"    notice, this list of conditions and the following disclaimer.
18.\" 2. Redistributions in binary form must reproduce the above copyright
19.\"    notice, this list of conditions and the following disclaimer in the
20.\"    documentation and/or other materials provided with the distribution.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"'
34
35MANTMPL1='.Dd November 21, 2010
36.Dt RUMP_XXXFSXXX 8
37.Os
38.Sh NAME
39.Nm rump_xxxfsxxx
40.Nd mount a xxxfsxxx xxxfssrcxxx with a userspace server
41.Sh SYNOPSIS
42.Cd "file-system PUFFS"
43.Cd "pseudo-device putter"
44.Pp
45.Nm
46.Op options
47.Ar xxximagexxx
48.Ar mountpoint
49.Sh DESCRIPTION
50.Em NOTE!
51This manual page describes features specific to the
52.Xr rump 3
53file server.
54Please see
55.Xr mount_xxxfsxxx 8
56for a full description of the available command line options.
57.Pp
58The
59.Nm
60utility can be used to mount xxxfsxxx file systems.
61It uses
62.Xr rump 3
63and
64.Xr p2k 3
65to facilitate running the file system as a server in userspace.
66As opposed to
67.Xr mount_xxxfsxxx 8 ,
68.Nm
69does not use file system code within the kernel and therefore does
70not require kernel support except
71.Xr puffs 4 .
72Apart from a minor speed penalty there is no downside with respect to
73in-kernel code.'
74
75MANTMPL_BLK='.Pp
76.Nm
77does not require using
78.Xr vnconfig 8
79for mounts from regular files and the file path can be passed
80directly as the
81.Ar xxximagexxx
82parameter.
83In fact, the use of
84.Xr vnconfig 8
85is discouraged, since it is unable to properly deal with images on
86sparse files.
87.Pp
88In case the image contains multiple partitions, the desired partition
89must be indicated by appending the token
90.Dq %DISKLABEL:p%
91to the
92.Ar xxximagexxx
93path.
94The letter
95.Dq p
96specifies the partition as obtained via
97.Xr disklabel 8 .
98For example, to mount partition
99.Dq e
100from image
101.Pa /tmp/wd0.img ,
102use
103.Dq /tmp/wd0.img%DISKLABEL:e% .
104.Pp
105It is recommended that untrusted file system images be mounted with
106.Nm
107instead of
108.Xr mount_xxxfsxxx 8 .
109Corrupt file system images commonly cause the file system
110to crash the entire kernel, but with
111.Nm
112only the userspace server process will dump core.'
113
114MANTMPL_NET='.Pp
115Even though the
116.Nm
117file system client runs within a virtual rump kernel in userspace,
118it uses host network services
119.Pq by means of Dq rump sockin .
120This means that regardless of whether using
121.Nm
122or
123.Xr mount_xxxfsxxx 8 ,
124the same network configurations will be used.
125Currently,
126.Dq sockin
127supports IPv4.'
128
129MANTMPL2='.Pp
130To use
131.Nm
132via
133.Xr mount 8 ,
134the flags
135.Fl o Ar rump
136and
137.Fl t Ar xxxfsxxx
138should be given.
139Similarly,
140.Nm
141is used instead of
142.Xr mount_xxxfsxxx 8
143if
144.Dq rump
145is added to the options field of
146.Xr fstab 5 .
147.Sh SEE ALSO
148.Xr p2k 3 ,
149.Xr puffs 3 ,
150.Xr rump 3 ,
151.Xr mount_xxxfsxxx 8
152.Sh HISTORY
153The
154.Nm
155utility first appeared in
156.Nx xxxfirstxxx .'
157
158# vary manpages slightly based on the type of server in question
159disk="cd9660 efs ext2fs ffs hfs lfs msdos ntfs sysvbfs udf v7fs"
160net="nfs smbfs"
161fictional="fdesc kernfs tmpfs"
162special="au-naturel nqmfs syspuffs"
163
164first5="cd9660 efs ext2fs ffs hfs lfs msdos nfs ntfs syspuffs sysvbfs tmpfs udf"
165
166member ()
167{
168
169	what=$1
170	shift
171
172	while [ $# -gt 0 ] ; do
173		[ "$1" = "${what}" ] && return 0
174		shift
175	done
176	return 1
177}
178
179sedsub='s/xxxfsxxx/$fs/g\;s/XXXFSXXX/$fsc/g\;s/xxximagexxx/$image/g\;'\
180's/xxxfirstxxx/$first/g\;s/xxxfssrcxxx/$fssrc/g\;'
181
182# auto manual pages
183for x in rump_*
184do
185	fs=${x#rump_}
186
187	# see if we are dealing with a new server
188	if ! member $fs $disk $net $fictional $special ; then
189		echo ERROR: $fs not found in any class!
190		exit 1
191	fi
192
193	# special file systems have special manpages
194	member $fs $special && continue
195
196	# figure out our type
197	if member $fs $disk ; then
198		mytype=disk
199		image=image
200		fssrc=image
201	fi
202	if member $fs $net ; then
203		mytype=net
204		image=share
205		fssrc=share
206	fi
207	if member $fs $fictional ; then
208		mytype=special
209		image=$fs
210		fssrc='fictional fs'
211	fi
212
213	# which version did server first appear?
214	if member $fs $first5 ; then
215		first=5.0
216	else
217		first=6.0
218	fi
219
220	fsc=`echo $fs | tr '[:lower:]' '[:upper:]'`
221	eval sedstr="${sedsub}"
222
223	printf '.\\"	$NetBSD: makerumpmanpages.sh,v 1.12 2010/11/22 07:56:31 pooka Exp $\n.\\"\n' > rump_${fs}/rump_${fs}.8
224	echo ${COPYRIGHT} | sed -e 's/\$//g' >> rump_${fs}/rump_${fs}.8
225
226	echo ${MANTMPL1} | sed -e "$sedstr" >> rump_${fs}/rump_${fs}.8
227	[ ${mytype} = disk ] && \
228	    echo ${MANTMPL_BLK} | sed -e "$sedstr" >> rump_${fs}/rump_${fs}.8
229	[ ${mytype} = net ] && \
230	    echo ${MANTMPL_NET} | sed -e "$sedstr" >> rump_${fs}/rump_${fs}.8
231	echo ${MANTMPL2} | sed -e "$sedstr" >> rump_${fs}/rump_${fs}.8
232done
233