1*84d9c625SLionel Sambuc.\" $NetBSD: puffs_path.3,v 1.4 2009/02/20 14:26:56 pooka Exp $ 2490e0de5SThomas Veerman.\" 3490e0de5SThomas Veerman.\" Copyright (c) 2007 Antti Kantee. All rights reserved. 4490e0de5SThomas Veerman.\" 5490e0de5SThomas Veerman.\" Redistribution and use in source and binary forms, with or without 6490e0de5SThomas Veerman.\" modification, are permitted provided that the following conditions 7490e0de5SThomas Veerman.\" are met: 8490e0de5SThomas Veerman.\" 1. Redistributions of source code must retain the above copyright 9490e0de5SThomas Veerman.\" notice, this list of conditions and the following disclaimer. 10490e0de5SThomas Veerman.\" 2. Redistributions in binary form must reproduce the above copyright 11490e0de5SThomas Veerman.\" notice, this list of conditions and the following disclaimer in the 12490e0de5SThomas Veerman.\" documentation and/or other materials provided with the distribution. 13490e0de5SThomas Veerman.\" 14490e0de5SThomas Veerman.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15490e0de5SThomas Veerman.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16490e0de5SThomas Veerman.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17490e0de5SThomas Veerman.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18490e0de5SThomas Veerman.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19490e0de5SThomas Veerman.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20490e0de5SThomas Veerman.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21490e0de5SThomas Veerman.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22490e0de5SThomas Veerman.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23490e0de5SThomas Veerman.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24490e0de5SThomas Veerman.\" SUCH DAMAGE. 25490e0de5SThomas Veerman.\" 26490e0de5SThomas Veerman.Dd December 27, 2007 27490e0de5SThomas Veerman.Dt PUFFS_PATH 3 28490e0de5SThomas Veerman.Os 29490e0de5SThomas Veerman.Sh NAME 30490e0de5SThomas Veerman.Nm puffs_path 31490e0de5SThomas Veerman.Nd puffs pathbuilding routines 32490e0de5SThomas Veerman.Sh LIBRARY 33490e0de5SThomas Veerman.Lb libpuffs 34490e0de5SThomas Veerman.Sh SYNOPSIS 35490e0de5SThomas Veerman.In puffs.h 36490e0de5SThomas Veerman.Ft int 37490e0de5SThomas Veerman.Fo pu_pathbuild_fn 38490e0de5SThomas Veerman.Fa "struct puffs_usermount *pu" "const struct puffs_pathobj *po_dir" 39490e0de5SThomas Veerman.Fa "const struct puffs_pathobj *po_comp" "size_t offset" 40490e0de5SThomas Veerman.Fa "struct puffs_pathobj *po_new" 41490e0de5SThomas Veerman.Fc 42490e0de5SThomas Veerman.Ft int 43490e0de5SThomas Veerman.Fo pu_pathtransform_fn 44490e0de5SThomas Veerman.Fa "struct puffs_usermount *pu" "const struct puffs_pathobj *po_base" 45490e0de5SThomas Veerman.Fa "const struct puffs_cn *pcn" "struct puffs_pathobj *po_new" 46490e0de5SThomas Veerman.Fc 47490e0de5SThomas Veerman.Ft int 48490e0de5SThomas Veerman.Fo pu_pathcmp_fn 49490e0de5SThomas Veerman.Fa "struct puffs_usermount *pu" "struct puffs_pathobj *po1" 50490e0de5SThomas Veerman.Fa "struct puffs_pathobj *po2" "size_t checklen" "int checkprefix" 51490e0de5SThomas Veerman.Fc 52490e0de5SThomas Veerman.Ft void 53490e0de5SThomas Veerman.Fn pu_pathfree_fn "struct puffs_usermount *pu" "struct puffs_pathobj *po" 54490e0de5SThomas Veerman.Ft int 55490e0de5SThomas Veerman.Fo pu_namemod_fn 56490e0de5SThomas Veerman.Fa "struct puffs_usermount *pu" "struct puffs_pathobj *po_dir" 57490e0de5SThomas Veerman.Fa "struct puffs_cn *pcn" 58490e0de5SThomas Veerman.Fc 59490e0de5SThomas Veerman.Ft struct puffs_pathobj * 60490e0de5SThomas Veerman.Fn puffs_getrootpathobj "struct puffs_usermount *pu" 61490e0de5SThomas Veerman.Sh DESCRIPTION 62490e0de5SThomas VeermanThe puffs library has the ability to provide full pathnames for backends 63490e0de5SThomas Veermanwhich require them. 64490e0de5SThomas VeermanNormal file systems should be constructed without the file system 65490e0de5SThomas Veermannode tied to a file name and should not used routines described herein. 66490e0de5SThomas VeermanAn example of a file system where the backend requires filenames is 67490e0de5SThomas Veerman.Xr mount_psshfs 8 . 68490e0de5SThomas Veerman.Pp 69490e0de5SThomas VeermanThe features described here are enabled by passing 70490e0de5SThomas Veerman.Dv PUFFS_FLAG_BUILDPATH 71490e0de5SThomas Veermanto 72490e0de5SThomas Veerman.Fn puffs_init . 73490e0de5SThomas VeermanThis facility requires to use puffs nodes to store the contents of the 74490e0de5SThomas Veermanpathname. 75490e0de5SThomas VeermanEither the address of the operation cookie must directly be that of the 76490e0de5SThomas Veermanpuffs node, or 77490e0de5SThomas Veerman.Fn puffs_set_cmap 78490e0de5SThomas Veermanmust be used to set a mapping function from the cookie to the puffs 79490e0de5SThomas Veermannode associated with the cookie. 80490e0de5SThomas VeermanFinally, the root node for the file system must be set using 81490e0de5SThomas Veerman.Fn puffs_setroot 82490e0de5SThomas Veermanand the root path object retrieved using 83490e0de5SThomas Veerman.Fn puffs_getrootpathobj 84490e0de5SThomas Veermanand initialized. 85490e0de5SThomas Veerman.Pp 86490e0de5SThomas VeermanThere are two different places a filename can be retrieved from. 87490e0de5SThomas VeermanIt is available for each puffs node after the node has been registered 88490e0de5SThomas Veermanwith the framework, i.e. 89490e0de5SThomas Veerman.Em after 90490e0de5SThomas Veermanthe routine creating the node returns. 91490e0de5SThomas VeermanIn other words, there is a window between the node is created and 92490e0de5SThomas Veermanwhen the pathname is available and multithreaded file systems must 93490e0de5SThomas Veermantake this into account. 94490e0de5SThomas VeermanThe second place where a pathname is available is from the componentname 95490e0de5SThomas Veerman.Vt struct puffs_pcn 96490e0de5SThomas Veermanin operations which are passed one. 97490e0de5SThomas VeermanThese can be retrieved using the convenience macros 98490e0de5SThomas Veerman.Fn PNPATH 99490e0de5SThomas Veermanand 100490e0de5SThomas Veerman.Fn PCNPATH 101490e0de5SThomas Veermanfor node and componentname, respectively. 102490e0de5SThomas VeermanThe type of object they return is 103490e0de5SThomas Veerman.Vt void * . 104490e0de5SThomas Veerman.Pp 105490e0de5SThomas VeermanBy default the framework manages "regular" filenames, which consist 106490e0de5SThomas Veermanof directory names separated by "/" and a final component. 107490e0de5SThomas VeermanIf the file system wishes to use pathnames of this format, all it 108490e0de5SThomas Veermanhas to do it enable the feature. 109490e0de5SThomas VeermanEverything else, including bookkeeping for node and directory renames, 110490e0de5SThomas Veermanis done by the library. 111490e0de5SThomas VeermanThe callback routines described next provide the ability to build 112490e0de5SThomas Veermannon-standard pathnames. 113490e0de5SThomas VeermanA 114490e0de5SThomas Veerman.Fn pu_foo_fn 115490e0de5SThomas Veermancallback is set using the 116490e0de5SThomas Veerman.Fn puffs_set_foo 117490e0de5SThomas Veermanroutine. 118490e0de5SThomas Veerman.Pp 119490e0de5SThomas VeermanThis manual page is still unfinished. 120490e0de5SThomas VeermanPlease take a number and wait in line. 121490e0de5SThomas Veerman.Sh SEE ALSO 122490e0de5SThomas Veerman.Xr puffs 3 , 123490e0de5SThomas Veerman.Xr puffs_node 3 , 124490e0de5SThomas Veerman.Xr mount_psshfs 8 , 125490e0de5SThomas Veerman.Xr mount_sysctlfs 8 126