xref: /netbsd/sbin/mount_portal/mount_portal.8 (revision bf9ec67e)
1.\"	$NetBSD: mount_portal.8,v 1.15 2002/02/08 01:30:44 ross Exp $
2.\"
3.\" Copyright (c) 1993, 1994
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" This code is derived from software donated to Berkeley by
7.\" Jan-Simon Pendry.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"	This product includes software developed by the University of
20.\"	California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\"    may be used to endorse or promote products derived from this software
23.\"    without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
36.\"
37.\"	@(#)mount_portal.8	8.3 (Berkeley) 3/27/94
38.\"
39.Dd March 27, 1994
40.Dt MOUNT_PORTAL 8
41.Os
42.Sh NAME
43.Nm mount_portal
44.Nd mount the portal daemon
45.Sh SYNOPSIS
46.Nm ""
47.Op Fl o Ar options
48.Ar /etc/portal.conf
49.Ar mount_point
50.Sh DESCRIPTION
51The
52.Nm
53command attaches an instance of the portal daemon
54to the global filesystem namespace.
55The conventional mount point is
56.Pa /p .
57This command is normally executed by
58.Xr mount 8
59at boot time.
60.Pp
61The options are as follows:
62.Bl -tag -width indent
63.It Fl o
64Options are specified with a
65.Fl o
66flag followed by a comma separated string of options.
67See the
68.Xr mount 8
69man page for possible options and their meanings.
70.El
71.Pp
72The portal daemon provides an
73.Em open
74service.
75Objects opened under the portal mount point are
76dynamically created by the portal daemon according
77to rules specified in the named configuration file.
78Using this mechanism allows descriptors such as sockets
79to be made available in the filesystem namespace.
80.Pp
81The portal daemon works by being passed the full pathname
82of the object being opened.
83The daemon creates an appropriate descriptor according
84to the rules in the configuration file, and then passes the descriptor back
85to the calling process as the result of the open system call.
86.Sh NAMESPACE
87By convention, the portal daemon divides the namespace into sub-namespaces,
88each of which handles objects of a particular type.
89.Pp
90Currently, four sub-namespaces are implemented:
91.Pa tcp ,
92.Pa fs ,
93.Pa rfilter
94and
95.Pa wfilter .
96The
97.Pa tcp
98namespace takes a hostname and a port (slash separated) and
99creates an open TCP/IP connection.
100The
101.Pa fs
102namespace opens the named file, starting back at the root directory.
103This can be used to provide a controlled escape path from
104a chrooted environment.
105.Pp
106The
107.Pa rfilter
108and
109.Pa wfilter
110namespaces open a pipe to a process, typically a data-filter such
111as compression or decompression programs.  The
112.Pa rfilter
113namespace opens a read-only pipe, while the
114.Pa wfilter
115namespace opens a write-only pipe.  See the EXAMPLES section
116below for more examples.
117.Sh CONFIGURATION FILE
118The configuration file contains a list of rules.
119Each rule takes one line and consists of two or more
120whitespace separated fields.
121A hash (``#'') character causes the remainder of a line to
122be ignored.  Blank lines are ignored.
123.Pp
124The first field is a pathname prefix to match
125against the requested pathname.
126If a match is found, the second field
127tells the daemon what type of object to create.
128Subsequent fields are passed to the creation function.
129.Pp
130The
131.Pa rfilter
132and
133.Pa wfilter
134namespaces have additional meanings for the remaining fields.
135The third field specifies a prefix that is to be stripped off of
136the passed name before passing it on to the pipe program.  If the
137prefix does not match, no stripping is performed.  The fourth
138argument specifies the program to use for the pipe.  Any
139remaining fields are passed to the pipe program.  If the
140string
141.Dq Li "%s"
142exists within these remaining fields, it will be replaced by the
143path after stripping is performed.  If there is no field after
144the program name,
145.Dq Li "%s"
146will be assumed, to maintain similarity with the
147.Pa tcp
148and
149.Pa fs
150namespaces.
151.Sh FILES
152.Bl -tag -width /p/* -compact
153.It Pa /p/*
154.El
155.Sh EXAMPLES
156A tutorial and several examples are provided in
157/usr/share/examples/mount_portal.  The following is an example
158configuration file.
159.Pp
160.Bd -literal
161# @(#)portal.conf	5.1 (Berkeley) 7/13/92
162tcp/		tcp tcp/
163fs/		file fs/
164echo/		rfilter	echo/	echo %s
165echo_nostrip/	rfilter	nostrip	echo %s
166echo_noslash    rfilter echo_noslash    echo %s
167gzcat/		rfilter gzcat/ gzcat %s
168gzip/		wfilter	gzip/	gzip \*[Gt] %s
169gzip9/		wfilter	gzip9/	gzip -9 \*[Gt] %s
170ftp/		rfilter	ftp/	ftp -Vo - %s
171ftp://		rfilter	nostrip	ftp -Vo - %s
172http://		rfilter	nostrip	ftp -Vo - %s
173bzcat/		rfilter	bzcat/	bzcat %s
174nroff/		rfilter	nroff/	nroff -man %s
175.Ed
176.Pp
177As is true with many other filesystems, a weird sense of humor is
178handy.
179.Pp
180Notice that after the keynames, like nroff/ and bzcat/, we
181typically use another slash.  In reality, the
182.Nm
183process changes directory to /, which makes the subsequent slash
184unnecessary.  However, the extra slash provides a visual hint
185that we are not operating on an ordinary file.  An alternative
186would be to change the configuration file to something like:
187.Bd -literal
188nroff%	rfilter	nroff%	nroff -man
189.Ed
190.Pp
191One might then use
192.Bd -literal
193less /p/nroff%/usr/share/man/man8/mount_portal.8
194.Ed
195.Sh SEE ALSO
196.Xr mount 2 ,
197.Xr unmount 2 ,
198.Xr fstab 5 ,
199.Xr mount 8
200.Sh HISTORY
201The
202.Nm
203utility first appeared in
204.Bx 4.4 .
205The
206.Pa rfilter
207and
208.Pa wfilter
209capabilities first appeared in
210.Nx 1.5 .
211.Sh BUGS
212This filesystem may not be NFS-exported.
213