1.\" $NetBSD: p2k.3,v 1.7 2009/11/21 22:32:52 wiz 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 November 21, 2009 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 vfs protocol and 67back again. 68It can therefore be used to mount and run kernel file system code as 69a userspace daemon. 70.Pp 71Calling the library interface function mounts the file system and, 72if succesful, starts handling requests. 73The parameters are handled by 74.Fn ukfs_mount 75(see 76.Xr ukfs 3 ) , 77with the exception that 78.Fa mountpath 79and 80.Fa puffs_flags 81are handled by 82.Xr puffs 3 . 83The "run_fs" variants of the interfaces are provided as a convenience 84for the common case. 85They execute all of init, setup and mainloop in one call. 86.Pp 87The following environment variables affect the behaviour of 88.Nm . 89They are useful mostly for debugging purposes. 90The flags are environment variables because typically the command line 91arguments to 92.Nm 93utilities are parsed using versions not aware of 94.Nm 95options; for example, the 96.Xr rump_cd9660 8 97arguments are really parsed by 98.Xr mount_cd9660 8 . 99.Bl -tag -width "XP2K_NOCACHE_PAGE" 100.It Dv P2K_DEBUG 101Do not detach from tty and print information about each puffs operation. 102.It Dv P2K_NODETACH 103Do not detach from tty. 104.It Dv P2K_NOCACHE_PAGE 105Do not use the puffs page cache. 106.It Dv P2K_NOCACHE_NAME 107Do not use the puffs name cache. 108.It Dv P2K_NOCACHE 109Do not use the puffs page or name cache. 110.It Dv P2K_WIZARDUID 111If set, use the value of the variable to determine the UID of the 112caller of each operation instead of the actual caller supplied by 113.Xr puffs 3 . 114This can be used for example to simplify modifying an OS installations 115root image as a non-root user. 116If the variable is set but does not contain an integer value, 0 117(root) is used. 118.El 119.Sh SEE ALSO 120.Xr puffs 3 , 121.Xr rump 3 , 122.Xr ukfs 3 , 123.Xr rump_cd9660 8 , 124.Xr rump_efs 8 , 125.Xr rump_ext2fs 8 , 126.Xr rump_ffs 8 , 127.Xr rump_hfs 8 , 128.Xr rump_lfs 8 , 129.Xr rump_msdos 8 , 130.Xr rump_nfs 8 , 131.Xr rump_ntfs 8 , 132.Xr rump_smbfs 8 , 133.Xr rump_syspuffs 8 , 134.Xr rump_sysvbfs 8 , 135.Xr rump_tmpfs 8 , 136.Xr rump_udf 8 137