.\"	$NetBSD: puffs_node.3,v 1.5 2009/05/13 22:42:31 wiz Exp $
.\"
.\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd June 24, 2007
.Dt PUFFS_NODE 3
.Os
.Sh NAME
.Nm puffs_node
.Nd puffs node routines
.Sh LIBRARY
.Lb libpuffs
.Sh SYNOPSIS
.In puffs.h
.Ft struct puffs_node *
.Fn puffs_pn_new "struct puffs_usermount *pu" "void *priv"
.Ft void *
.Fo puffs_nodewalk_fn
.Fa "struct puffs_usermount *pu" "struct puffs_node *pn" "void *arg"
.Fc
.Ft void *
.Fo puffs_pn_nodewalk
.Fa "struct puffs_usermount *pu" "puffs_nodewalk_fn nwfn" "void *arg"
.Fc
.Ft void
.Fn puffs_pn_remove "struct puffs_node *pn"
.Ft void
.Fn puffs_pn_put "struct puffs_node *pn"
.Sh DESCRIPTION
.Bl -tag -width xxxx
.It Fn puffs_pn_new pu priv
Create a new node and attach it to the mountpoint
.Ar pu .
The argument
.Ar priv
can be used for associating file system specific data with the new
node and will not be accessed by puffs.
.It Fn puffs_nodewalk_fn pu pn arg
A callback for
.Fn puffs_nodewalk .
The list of nodes is iterated in the argument
.Ar pn
and the argument
.Ar arg
is the argument given to
.Fn puffs_nodewalk .
.It Fn puffs_nodewalk pu nwfn arg
Walk all nodes associted with the mountpoint
.Ar pu
and call
.Fn nwfn
for them.
The walk is aborted if
.Fn puffs_nodewalk_fn
returns a value which is not
.Dv NULL .
This value is also returned this function.
In case the whole set of nodes is traversed,
.Dv NULL
is returned.
This function is useful for example in handling the
.Fn puffs_fs_sync
callback, when cached data for every node should be flushed to stable
storage.
.It Fn puffs_pn_remove pn
Signal that a node has been removed from the file system, but do not
yet release resources associated with the node.
This will prevent the nodewalk functions from accessing the node.
If necessary, this is usually called from
.Fn puffs_node_remove
and
.Fn puffs_node_rmdir .
.It Fn puffs_pn_put pn
Free all resources associated with node
.Ar pn .
This is typically called from
.Fn puffs_node_reclaim .
.El
.Sh SEE ALSO
.Xr puffs 3