xref: /netbsd/lib/libp2k/p2k.3 (revision 7a749a7c)
1.\"     $NetBSD: p2k.3,v 1.12 2022/07/11 19:24:56 andvar Exp $
2.\"
3.\" Copyright (c) 2008 Antti Kantee.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd July 11, 2022
27.Dt P2K 3
28.Os
29.Sh NAME
30.Nm p2k
31.Nd puffs to kernel vfs translation library
32.Sh LIBRARY
33p2k Library (libp2k, \-lp2k)
34.Sh SYNOPSIS
35.In rump/p2k.h
36.Ft struct p2k_mount *
37.Fn p2k_init "uint32_t puffs_flags"
38.Ft void
39.Fn p2k_cancel "struct p2k_mount *p2m" "int error"
40.Ft int
41.Fo p2k_setup_fs
42.Fa "struct p2k_mount *p2m" "const char *vfsname" "const char *devpath"
43.Fa "const char *mountpath" "int mntflags" "void *arg" "size_t alen"
44.Fc
45.Fo p2k_setup_diskfs
46.Fa "struct p2k_mount *p2m" "const char *vfsname" "const char *devpath"
47.Fa "int partition" "const char *mountpath" "int mntflags"
48.Fa "void *arg" "size_t alen"
49.Fc
50.Ft int
51.Fn p2k_mainloop "struct p2k_mount *p2m"
52.Ft int
53.Fo p2k_run_fs
54.Fa "const char *vfsname" "const char *devpath" "const char *mountpath"
55.Fa "int mntflags" "void *arg" "size_t alen" "uint32_t puffs_flags"
56.Fc
57.Ft int
58.Fo p2k_run_diskfs
59.Fa "const char *vfsname" "const char *devpath" "int partition"
60.Fa "const char *mountpath" "int mntflags" "void *arg" "size_t alen"
61.Fa "uint32_t puffs_flags"
62.Fc
63.Sh DESCRIPTION
64The
65.Nm
66library translates the puffs protocol to the kernel
67.Xr vfs 9
68protocol and back again.
69It can therefore be used to mount and run kernel file system code as
70a userspace daemon.
71.Pp
72Calling the library interface function mounts the file system and,
73if successful, starts handling requests.
74The parameters are handled by
75.Fn ukfs_mount
76(see
77.Xr ukfs 3 ) ,
78with the exception that
79.Fa mountpath
80and
81.Fa puffs_flags
82are handled by
83.Xr puffs 3 .
84The "run_fs" variants of the interfaces are provided as a convenience
85for the common case.
86They execute all of init, setup and mainloop in one call.
87.Sh ENVIRONMENT
88The following environment variables affect the behaviour of
89.Nm .
90They are useful mostly for debugging purposes.
91The flags are environment variables because typically the command line
92arguments to
93.Nm
94utilities are parsed using versions not aware of
95.Nm
96options; for example, the
97.Xr rump_cd9660 8
98arguments are really parsed by
99.Xr mount_cd9660 8 .
100.Bl -tag -width "XP2K_NOCACHE_PAGE" -offset 2n
101.It Dv P2K_DEBUG
102Do not detach from tty and print information about each puffs operation.
103In case the daemon receives
104.Dv SIGINFO
105(typically from ctrl-T), it dumps out the status of the mount point.
106Sending
107.Dv SIGUSR1
108causes a dump of all the vnodes (verbose).
109.It Dv P2K_NODETACH
110Do not detach from tty.
111.It Dv P2K_NOCACHE_PAGE
112Do not use the puffs page cache.
113.It Dv P2K_NOCACHE_NAME
114Do not use the puffs name cache.
115.It Dv P2K_NOCACHE
116Do not use the puffs page or name cache.
117.It Dv P2K_WIZARDUID
118If set, use the value of the variable to determine the UID of the
119caller of each operation instead of the actual caller supplied by
120.Xr puffs 3 .
121This can be used for example to simplify modifying an OS installation's
122root image as a non-root user.
123.El
124.Sh SEE ALSO
125.Xr puffs 3 ,
126.Xr rump 3 ,
127.Xr ukfs 3 ,
128.Xr rump_cd9660 8 ,
129.Xr rump_efs 8 ,
130.Xr rump_ext2fs 8 ,
131.Xr rump_ffs 8 ,
132.Xr rump_hfs 8 ,
133.Xr rump_lfs 8 ,
134.Xr rump_msdos 8 ,
135.Xr rump_nfs 8 ,
136.Xr rump_ntfs 8 ,
137.Xr rump_syspuffs 8 ,
138.Xr rump_sysvbfs 8 ,
139.Xr rump_tmpfs 8 ,
140.Xr rump_udf 8
141