2017-07-04 00:28:48 +03:00
|
|
|
.\" $NetBSD: puffs_ops.3,v 1.46 2017/07/03 21:32:51 wiz Exp $
|
2007-04-16 23:16:02 +04:00
|
|
|
.\"
|
|
|
|
.\" 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.
|
|
|
|
.\"
|
2016-08-29 04:13:56 +03:00
|
|
|
.Dd August 29, 2016
|
2007-04-16 23:16:02 +04:00
|
|
|
.Dt PUFFS_OPS 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm puffs_ops
|
|
|
|
.Nd puffs callback operations
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libpuffs
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In puffs.h
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_fs_statvfs
|
2007-11-30 22:02:28 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "struct statvfs *sbp"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_fs_sync
|
2007-11-30 22:02:28 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "int waitfor" "const struct puffs_cred *pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-07-19 23:25:09 +04:00
|
|
|
.Fo puffs_fs_fhtonode
|
2007-11-30 22:02:28 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "void *fid" "size_t fidsize"
|
2007-07-06 02:37:52 +04:00
|
|
|
.Fa "struct puffs_newinfo *pni"
|
2007-04-17 17:11:05 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_fs_nodetofh
|
2008-11-25 14:49:08 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t cookie" "void *fid"
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "size_t *fidsize"
|
2007-04-17 17:11:05 +04:00
|
|
|
.Fc
|
2015-11-09 18:12:12 +03:00
|
|
|
.Ft int
|
2010-05-21 15:20:50 +04:00
|
|
|
.Fo puffs_fs_extattrctl
|
|
|
|
.Fa "struct puffs_usermount *pu" "int cmd" "puffs_cookie_t cookie" "int flags"
|
|
|
|
.Fa "int attrnamespace" "const char *attrname"
|
|
|
|
.Fc
|
2007-04-17 17:11:05 +04:00
|
|
|
.Ft int
|
2007-07-19 01:24:40 +04:00
|
|
|
.Fo puffs_fs_unmount
|
2007-11-30 22:02:28 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "int flags"
|
2007-07-19 01:24:40 +04:00
|
|
|
.Fc
|
2007-04-16 23:16:02 +04:00
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_lookup
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "struct puffs_newinfo *pni" "const struct puffs_cn *pcn"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_create
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "struct puffs_newinfo *pni" "const struct puffs_cn *pcn"
|
|
|
|
.Fa "const struct vattr *vap"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_mknod
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "struct puffs_newinfo *pni" "const struct puffs_cn *pcn"
|
|
|
|
.Fa "const struct vattr *vap"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_open
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int mode"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2014-08-16 20:25:44 +04:00
|
|
|
.Fo puffs_node_open2
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int modep"
|
|
|
|
.Fa "const struct puffs_cred *pcr" "int *oflags"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_close
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int flags"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_access
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int mode"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fo puffs_node_getattr
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "struct vattr *vap"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_setattr
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "const struct vattr *vap"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
2007-05-18 18:38:15 +04:00
|
|
|
.Ft int
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fo puffs_node_getattr_ttl
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "struct vattr *vap"
|
|
|
|
.Fa "const struct puffs_cred *pcr" "struct timespec *va_ttl"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_setattr_ttl
|
2015-11-12 20:51:05 +03:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "struct vattr *vap"
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fa "const struct puffs_cred *pcr" "struct timespec *va_ttl" "int xflag"
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2016-08-29 04:13:56 +03:00
|
|
|
.Fo puffs_node_pathconf
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int name"
|
|
|
|
.Fa "register_t *retval"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_advlock
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "void *id" "int op"
|
|
|
|
.Fa "struct flock *fl" "int flags"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-05-18 18:38:15 +04:00
|
|
|
.Fo puffs_node_poll
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int *events"
|
2007-05-18 18:38:15 +04:00
|
|
|
.Fc
|
2007-04-16 23:16:02 +04:00
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_mmap
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int flags"
|
2007-11-27 14:31:17 +03:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_fsync
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "const struct puffs_cred *pcr" "int flags" "off_t offlo" "off_t offhi"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
2007-07-19 01:41:06 +04:00
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_seek
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t oldoff"
|
|
|
|
.Fa "off_t newoff" "const struct puffs_cred *pcr"
|
2007-07-19 01:41:06 +04:00
|
|
|
.Fc
|
2007-04-16 23:16:02 +04:00
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_remove
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "puffs_cookie_t targ"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa "const struct puffs_cn *pcn"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_link
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "puffs_cookie_t targ"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa "const struct puffs_cn *pcn"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_rename
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "puffs_cookie_t src"
|
|
|
|
.Fa "const struct puffs_cn *pcn_src" "puffs_cookie_t targ_dir"
|
|
|
|
.Fa "puffs_cookie_t targ" "const struct puffs_cn *pcn_targ"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_mkdir
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "struct puffs_newinfo *pni" "const struct puffs_cn *pcn"
|
|
|
|
.Fa "const struct vattr *vap"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_rmdir
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "puffs_cookie_t targ"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa "const struct puffs_cn *pcn"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fo puffs_node_readdir
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "struct dirent *dent"
|
2007-04-19 00:37:05 +04:00
|
|
|
.Fa "off_t *readoff" "size_t *reslen" "const struct puffs_cred *pcr"
|
2007-04-17 17:11:05 +04:00
|
|
|
.Fa "int *eofflag" "off_t *cookies" "size_t *ncookies"
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-07-25 12:31:19 +04:00
|
|
|
.Fo puffs_node_symlink
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "struct puffs_newinfo *pni"
|
2007-07-25 13:10:26 +04:00
|
|
|
.Fa "const struct puffs_cn *pcn_src" "const struct vattr *vap"
|
2007-07-25 12:31:19 +04:00
|
|
|
.Fa "const char *link_target"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fo puffs_node_readlink
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "const struct puffs_cred *pcr" "char *link" "size_t *linklen"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_read
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "uint8_t *buf"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_write
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "uint8_t *buf"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fo puffs_node_write2
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "uint8_t *buf"
|
|
|
|
.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
|
|
|
|
.Fa "int xflag"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2010-12-13 12:06:51 +03:00
|
|
|
.Fo puffs_node_abortop
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fa "const struct puffs_cn *pcn"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2010-05-21 15:20:50 +04:00
|
|
|
.Fo puffs_node_getextattr
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int attrnamespace"
|
|
|
|
.Fa "const char *attrname" "size_t *attrsize" "uint8_t *attr" "size_t *resid"
|
|
|
|
.Fa "const struct puffs_cred *pcr"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_setextattr
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int attrnamespace"
|
|
|
|
.Fa "const char *attrname" "uint8_t *attr" "size_t *resid"
|
|
|
|
.Fa "const struct puffs_cred *pcr"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_listextattr
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int attrnamespace"
|
2015-11-12 20:51:05 +03:00
|
|
|
.Fa "size_t *attrssize" "uint8_t *attrs" "size_t *resid" "int flag"
|
2010-05-21 15:20:50 +04:00
|
|
|
.Fa "const struct puffs_cred *pcr"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_deleteextattr
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int attrnamespace"
|
|
|
|
.Fa "const char *attrname"
|
|
|
|
.Fa "const struct puffs_cred *pcr"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2014-10-31 16:56:04 +03:00
|
|
|
.Fo puffs_node_fallocate
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_fdiscard
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "off_t pos" "off_t len"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
|
|
|
.Fo puffs_node_print
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
|
|
|
.Fc
|
2007-04-17 14:14:27 +04:00
|
|
|
.Ft int
|
2007-07-06 02:37:52 +04:00
|
|
|
.Fo puffs_node_reclaim
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
2007-07-06 02:37:52 +04:00
|
|
|
.Fc
|
2007-04-16 23:16:02 +04:00
|
|
|
.Ft int
|
2012-08-16 13:25:43 +04:00
|
|
|
.Fo puffs_node_reclaim2
|
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int nlookup"
|
|
|
|
.Fc
|
|
|
|
.Ft int
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fo puffs_node_inactive
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fc
|
2007-05-09 17:46:16 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn puffs_setback "struct puffs_cc *pcc" "int op"
|
2007-07-06 02:37:52 +04:00
|
|
|
.Ft void
|
2008-08-12 23:44:39 +04:00
|
|
|
.Fn puffs_newinfo_setcookie "struct puffs_newinfo *pni" "puffs_cookie_t cookie"
|
2007-07-06 02:37:52 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setvtype "struct puffs_newinfo *pni" "enum vtype vtype"
|
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setsize "struct puffs_newinfo *pni" "voff_t size"
|
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setrdev "struct puffs_newinfo *pni" "dev_t rdev"
|
2012-04-18 04:57:21 +04:00
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setva "struct puffs_newinfo *pni" "struct vattr *vap"
|
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setvattl "struct puffs_newinfo *pni" "struct timespec *va_ttl"
|
|
|
|
.Ft void
|
|
|
|
.Fn puffs_newinfo_setcnttl "struct puffs_newinfo *pni" "struct timespec *cn_ttl"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The operations
|
|
|
|
.Nm puffs
|
|
|
|
requires to function can be divided into two categories: file system
|
|
|
|
callbacks and node callbacks.
|
|
|
|
The former affect the entire file system while the latter are targeted
|
|
|
|
at a file or a directory and a file.
|
|
|
|
They are roughly equivalent to the vfs and vnode operations in the
|
|
|
|
kernel.
|
|
|
|
.Pp
|
|
|
|
All callbacks can be prototyped with the file system name and operation
|
|
|
|
name using the macro
|
|
|
|
.Fn PUFFSOP_PROTOS fsname .
|
|
|
|
.Ss File system callbacks (puffs_fs)
|
|
|
|
.Bl -tag -width xxxx
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_fs_statvfs "pu" "sbp"
|
2007-04-16 23:16:02 +04:00
|
|
|
The following fields of the argument
|
|
|
|
.Fa sbp
|
|
|
|
need to be filled:
|
|
|
|
.Bd -literal
|
|
|
|
* unsigned long f_bsize; file system block size
|
|
|
|
* unsigned long f_frsize; fundamental file system block size
|
|
|
|
* fsblkcnt_t f_blocks; number of blocks in file system,
|
|
|
|
* (in units of f_frsize)
|
|
|
|
*
|
|
|
|
* fsblkcnt_t f_bfree; free blocks avail in file system
|
|
|
|
* fsblkcnt_t f_bavail; free blocks avail to non-root
|
|
|
|
* fsblkcnt_t f_bresvd; blocks reserved for root
|
2007-07-19 23:25:09 +04:00
|
|
|
|
2007-04-16 23:16:02 +04:00
|
|
|
* fsfilcnt_t f_files; total file nodes in file system
|
|
|
|
* fsfilcnt_t f_ffree; free file nodes in file system
|
|
|
|
* fsfilcnt_t f_favail; free file nodes avail to non-root
|
|
|
|
* fsfilcnt_t f_fresvd; file nodes reserved for root
|
|
|
|
|
|
|
|
.Ed
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_fs_sync "pu" "waitfor" "pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
All the dirty buffers that have been cached at the file server
|
|
|
|
level including metadata should be committed to stable storage.
|
|
|
|
The
|
|
|
|
.Fa waitfor
|
|
|
|
parameter affects the operation.
|
|
|
|
Possible values are:
|
|
|
|
.Bl -tag -width XMNT_NOWAITX
|
|
|
|
.It Dv MNT_WAIT
|
|
|
|
Wait for all I/O for complete until returning.
|
|
|
|
.It Dv MNT_NOWAIT
|
|
|
|
Initiate I/O, but do not wait for completion.
|
|
|
|
.It Dv MNT_LAZY
|
|
|
|
Synchorize data not synchoronized by the file system syncer,
|
2012-04-18 18:24:26 +04:00
|
|
|
i.e., data not written when
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fn node_fsync
|
|
|
|
is called with
|
|
|
|
.Dv FSYNC_LAZY .
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The credentials for the initiator of the sync operation are present in
|
|
|
|
.Fa pcr
|
|
|
|
and will usually be either file system or kernel credentials, but might
|
|
|
|
also be user credentials.
|
|
|
|
However, most of the time it is advisable to sync regardless of the
|
|
|
|
credentials of the caller.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_fs_fhtonode "pu" "fid" "fidsize" "pni"
|
2007-04-17 17:11:05 +04:00
|
|
|
Translates a file handle
|
|
|
|
.Fa fid
|
|
|
|
to a node.
|
|
|
|
The parameter
|
|
|
|
.Fa fidsize
|
|
|
|
indicates how large the file handle is.
|
|
|
|
In case the file system's handles are static length, this parameter can
|
|
|
|
be ignored as the kernel guarantees all file handles passed to the file
|
|
|
|
server are of correct length.
|
|
|
|
For dynamic length handles the field should be examined and
|
|
|
|
.Er EINVAL
|
|
|
|
returned in case the file handle length is not correct.
|
|
|
|
.Pp
|
|
|
|
This function provides essentially the same information to the kernel as
|
|
|
|
.Fn puffs_node_lookup .
|
|
|
|
The information is necessary for creating a new vnode corresponding to
|
|
|
|
the file handle.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_fs_nodetofh "pu" "cookie" "fid" "fidsize"
|
2007-04-17 17:11:05 +04:00
|
|
|
Create a file handle from the node described by
|
|
|
|
.Fa cookie .
|
|
|
|
The file handle should contain enough information to reliably identify
|
|
|
|
the node even after reboots and the pathname/inode being replaced by
|
|
|
|
another file.
|
|
|
|
If this is not possible, it is up to the author of the file system to
|
|
|
|
act responsibly and decide if the file system can support file handles
|
|
|
|
at all.
|
|
|
|
.Pp
|
|
|
|
For file systems which want dynamic length file handles, this function
|
|
|
|
must check if the file handle space indicated by
|
|
|
|
.Fa fidsize
|
|
|
|
is large enough to accommodate the file handle for the node.
|
|
|
|
If not, it must fill in the correct size and return
|
|
|
|
.Er E2BIG .
|
|
|
|
In either case, the handle length should be supplied to the kernel in
|
|
|
|
.Fa fidsize .
|
|
|
|
File systems with static length handles can ignore the size parameter as
|
|
|
|
the kernel always supplies the correct size buffer.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_fs_unmount "pu" "flags"
|
2007-04-16 23:16:02 +04:00
|
|
|
Unmount the file system.
|
|
|
|
The kernel has assumedly flushed all cached data when this callback
|
|
|
|
is executed.
|
|
|
|
If the file system cannot currently be safely be unmounted, for whatever
|
|
|
|
reason, the kernel will honor an error value and not forcibly unmount.
|
|
|
|
However, if the flag
|
|
|
|
.Dv MNT_FORCE
|
|
|
|
is not honored by the file server, the kernel will forcibly unmount
|
|
|
|
the file system.
|
|
|
|
.El
|
|
|
|
.Ss Node callbacks
|
|
|
|
These operations operate in the level of individual files.
|
|
|
|
The file cookie is always provided as the second argument
|
|
|
|
.Fa opc .
|
|
|
|
If the operation is for a file, it will be the cookie of the file.
|
|
|
|
The case the operation involves a directory (such as
|
|
|
|
.Dq create file in directory ) ,
|
|
|
|
the cookie will be for the directory.
|
|
|
|
Some operations take additional cookies to describe the rest of
|
|
|
|
the operands.
|
|
|
|
The return value 0 signals success, else an appropriate errno value
|
|
|
|
should be returned.
|
|
|
|
Please note that neither this list nor the descriptions are complete.
|
|
|
|
.Bl -tag -width xxxx
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_lookup "pu" "opc" "pni" "pcn"
|
2007-04-16 23:16:02 +04:00
|
|
|
This function is used to locate nodes, or in other words translate
|
|
|
|
pathname components to file system data structures.
|
|
|
|
The implementation should match the name in
|
|
|
|
.Fa pcn
|
|
|
|
against the existing entries in the directory provided by the cookie
|
|
|
|
.Fa opc .
|
2007-07-06 02:37:52 +04:00
|
|
|
If found, the cookie for the located node should be set in
|
|
|
|
.Fa pni
|
|
|
|
using
|
|
|
|
.Fn puffs_newinfo_setcookie .
|
|
|
|
Additionally, the vnode type and size (latter applicable to regular files only)
|
|
|
|
should be set using
|
|
|
|
.Fn puffs_newinfo_setvtype
|
2007-04-16 23:16:02 +04:00
|
|
|
and
|
2007-07-06 02:37:52 +04:00
|
|
|
.Fn puffs_newinfo_setsize ,
|
2007-04-16 23:16:02 +04:00
|
|
|
respectively.
|
|
|
|
If the located entry is a block device or character device file,
|
2007-07-06 02:37:52 +04:00
|
|
|
the dev_t for the entry should be set using
|
|
|
|
.Fn puffs_newinfo_setrdev .
|
2007-04-16 23:16:02 +04:00
|
|
|
.Pp
|
2012-04-18 18:24:26 +04:00
|
|
|
If
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fn puffs_init
|
|
|
|
was called with
|
|
|
|
.Dv PUFFS_KFLAG_CACHE_FS_TTL
|
2012-04-18 18:24:26 +04:00
|
|
|
then
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fn puffs_newinfo_setva ,
|
|
|
|
.Fn puffs_newinfo_setvattl ,
|
|
|
|
and
|
|
|
|
.Fn puffs_newinfo_setcnttl
|
|
|
|
can be called to specify the new node attributes, cached attributes
|
2012-04-18 18:24:26 +04:00
|
|
|
time to live, and cached name time to live.
|
2012-04-18 04:57:21 +04:00
|
|
|
.Pp
|
2007-04-16 23:16:02 +04:00
|
|
|
The type of operation is found from
|
2017-07-04 00:28:48 +03:00
|
|
|
.Va pcn->pcn_nameiop :
|
2011-04-19 14:35:24 +04:00
|
|
|
.Bl -tag -width XNAMEI_LOOKUPX
|
|
|
|
.It Dv NAMEI_LOOKUP
|
2007-04-16 23:16:02 +04:00
|
|
|
Normal lookup operation.
|
2011-04-19 14:35:24 +04:00
|
|
|
.It Dv NAMEI_CREATE
|
2007-04-16 23:16:02 +04:00
|
|
|
Lookup to create a node.
|
2011-04-19 14:35:24 +04:00
|
|
|
.It Dv NAMEI_DELETE
|
2007-04-16 23:16:02 +04:00
|
|
|
Lookup for node deletion.
|
2011-04-19 14:35:24 +04:00
|
|
|
.It Dv NAMEI_RENAME
|
2007-04-16 23:16:02 +04:00
|
|
|
Lookup for the target of a rename operation (source will be looked
|
|
|
|
up using
|
2011-04-19 14:35:24 +04:00
|
|
|
.Dv NAMEI_DELETE ) .
|
2007-04-16 23:16:02 +04:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
The final component from a pathname lookup usually requires special
|
|
|
|
treatment.
|
|
|
|
It can be identified by looking at the
|
2017-07-04 00:28:48 +03:00
|
|
|
.Va pcn->pcn_flags
|
2007-04-16 23:16:02 +04:00
|
|
|
fields for the flag
|
|
|
|
.Dv PUFFSLOOKUP_ISLASTCN .
|
|
|
|
For example, in most cases the lookup operation will want to check if
|
|
|
|
a delete, rename or create operation has enough credentials to perform
|
|
|
|
the operation.
|
|
|
|
.Pp
|
|
|
|
The return value 0 signals a found node and a nonzero value signals
|
|
|
|
an errno.
|
|
|
|
As a special case,
|
|
|
|
.Er ENOENT
|
|
|
|
signals "success" for cases where the lookup operation is
|
2011-04-19 14:35:24 +04:00
|
|
|
.Dv NAMEI_CREATE
|
2007-04-16 23:16:02 +04:00
|
|
|
or
|
2011-04-19 14:35:24 +04:00
|
|
|
.Dv NAMEI_RENAME .
|
2007-04-16 23:16:02 +04:00
|
|
|
Failure in these cases can be signalled by returning another appropriate
|
|
|
|
error code, for example
|
|
|
|
.Er EACCESS .
|
2007-07-06 02:37:52 +04:00
|
|
|
.Pp
|
|
|
|
Usually a null-terminated string for the next pathname component is
|
|
|
|
provided in
|
2017-07-04 00:28:48 +03:00
|
|
|
.Ar pcn->pcn_name .
|
2007-07-06 02:37:52 +04:00
|
|
|
In case the file system is using the option
|
|
|
|
.Dv PUFFS_KFLAG_LOOKUP_FULLPNBUF ,
|
|
|
|
the remainder of the complete pathname under lookup is found in
|
|
|
|
the same location.
|
2017-07-04 00:28:48 +03:00
|
|
|
.Ar pcn->pcn_namelen
|
2007-07-06 02:37:52 +04:00
|
|
|
always specifies the length of the next component.
|
|
|
|
If operating with a full path, the file system is allowed to consume
|
|
|
|
more than the next component's length in node lookup.
|
|
|
|
This is done by setting
|
2017-07-04 00:28:48 +03:00
|
|
|
.Ar pcn->pcn_consume
|
2007-07-06 02:37:52 +04:00
|
|
|
to indicate the amount of
|
|
|
|
.Em extra
|
|
|
|
characters in addition to
|
2017-07-04 00:28:48 +03:00
|
|
|
.Ar pcn->pcn_namelen
|
2007-07-06 02:37:52 +04:00
|
|
|
processed.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_create "pu" "opc" "pni" "pcn" "va"
|
|
|
|
.It Fn puffs_node_mkdir "pu" "opc" "pni" "pcn" "va"
|
|
|
|
.It Fn puffs_node_mknod "pu" "opc" "pni" "pcn" "va"
|
2007-04-17 14:14:27 +04:00
|
|
|
A file node is created in the directory denoted by the cookie
|
|
|
|
.Fa opc
|
|
|
|
by any of the above callbacks.
|
|
|
|
The name of the new file can be found from
|
|
|
|
.Fa pcn
|
|
|
|
and the attributes are specified by
|
|
|
|
.Fa va
|
2007-07-06 02:37:52 +04:00
|
|
|
and the cookie for the newly created node should be set in
|
|
|
|
.Fa pni .
|
2007-04-17 14:14:27 +04:00
|
|
|
The only difference between these three is that they create a regular
|
|
|
|
file, directory and device special file, respectively.
|
|
|
|
.Pp
|
|
|
|
In case of mknod, the device identifier can be found in
|
2017-07-04 00:28:48 +03:00
|
|
|
.Fa va->va_rdev .
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_open "pu" "opc" "mode" "pcr"
|
2014-08-16 20:25:44 +04:00
|
|
|
.It Fn puffs_node_open2 "pu" "opc" "mode" "pcr" "oflags"
|
2007-04-17 14:14:27 +04:00
|
|
|
Open the node denoted by the cookie
|
|
|
|
.Fa opc .
|
|
|
|
The parameter
|
|
|
|
.Fa mode
|
|
|
|
specifies the flags that
|
|
|
|
.Xr open 2
|
|
|
|
was called with, e.g.
|
|
|
|
.Dv O_APPEND
|
|
|
|
and
|
|
|
|
.Dv O_NONBLOCK .
|
2014-08-16 20:25:44 +04:00
|
|
|
.Fn puffs_node_open2
|
2015-02-16 13:48:56 +03:00
|
|
|
allows the file system to pass back information for the file in
|
2014-08-16 20:25:44 +04:00
|
|
|
.Fa oflags .
|
|
|
|
The only implemented flag for now is
|
|
|
|
.Dv PUFFS_OPEN_IO_DIRECT
|
|
|
|
that cause file read/write to bypass the page cache.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_close "pu" "opc" "flags" "pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
Close a node.
|
|
|
|
The parameter
|
|
|
|
.Fa flags
|
|
|
|
parameter describes the flags that the file was opened with.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_access "pu" "opc" "mode" "pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
Check if the credentials of
|
|
|
|
.Fa pcr
|
|
|
|
have the right to perform the operation specified by
|
|
|
|
.Fa mode
|
|
|
|
onto the node
|
|
|
|
.Fa opc .
|
|
|
|
The argument
|
|
|
|
.Fa mode
|
|
|
|
can specify read, write or execute by
|
|
|
|
.Dv PUFFS_VREAD ,
|
2007-12-02 22:43:10 +03:00
|
|
|
.Dv PUFFS_VWRITE ,
|
2007-04-17 14:14:27 +04:00
|
|
|
and
|
|
|
|
.Dv PUFFS_VEXEC ,
|
|
|
|
respectively.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_getattr "pu" "opc" "va" "pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
The attributes of the node specified by
|
|
|
|
.Fa opc
|
|
|
|
must be copied to the space pointed by
|
|
|
|
.Fa va .
|
2012-04-18 04:57:21 +04:00
|
|
|
.It Fn puffs_node_getattr_ttl "pu" "opc" "va" "pcr" "va_ttl"
|
|
|
|
Same as
|
|
|
|
.Fn puffs_node_getattr
|
|
|
|
with cached attribute time to live specified in
|
|
|
|
.Fa va_ttl
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_setattr "pu" "opc" "va" "pcr"
|
2007-04-16 23:16:02 +04:00
|
|
|
The attributes for the node specified by
|
|
|
|
.Fa opc
|
|
|
|
must be set to those contained in
|
|
|
|
.Fa va .
|
|
|
|
Only fields of
|
|
|
|
.Fa va
|
|
|
|
which contain a value different from
|
|
|
|
.Dv PUFFS_VNOVAL
|
|
|
|
(typecast to the field's type!) contain a valid value.
|
2012-06-27 17:25:23 +04:00
|
|
|
.It Fn puffs_node_setattr_ttl "pu" "opc" "va" "pcr" "va_ttl" "xflag"
|
2012-04-18 04:57:21 +04:00
|
|
|
Same as
|
|
|
|
.Fn puffs_node_setattr
|
|
|
|
with cached attribute time to live specified in
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fa va_ttl .
|
|
|
|
.Dv PUFFS_SETATTR_FAF
|
2012-06-28 00:30:52 +04:00
|
|
|
will be set in
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fa xflag
|
|
|
|
for Fire-And-Forget operations.
|
2016-08-29 04:13:56 +03:00
|
|
|
.It Fn puffs_node_pathconf "pu" "opc" "name" "retval"
|
|
|
|
The value of the
|
|
|
|
.Xr pathconf 2
|
|
|
|
filesystem limit specified in
|
|
|
|
.Ar name
|
|
|
|
for the node
|
|
|
|
.Ar opc
|
|
|
|
should be copied to the space pointed to by
|
|
|
|
.Ar retval .
|
|
|
|
.It Fn puffs_node_advlock "po" "opc" "id" "op" "fl" "flags"
|
|
|
|
Manipulate advisory record locks on the node
|
|
|
|
.Ar opc .
|
|
|
|
The argument
|
|
|
|
.Ar id
|
|
|
|
is the id token which is changing the lock,
|
|
|
|
.Ar op
|
|
|
|
is the
|
|
|
|
.Xr fcntl 2
|
|
|
|
operation to perform,
|
|
|
|
.Ar fl
|
|
|
|
is the lock descriptor structure and
|
|
|
|
.Ar flags
|
|
|
|
are the flags as defined in
|
|
|
|
.Xr VOP_ADVLOCK 9 .
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_poll "pu" "opc" "events"
|
2007-05-18 18:38:15 +04:00
|
|
|
Poll for events on node
|
|
|
|
.Ar opc .
|
|
|
|
If
|
|
|
|
.Xr poll 2
|
|
|
|
events specified in
|
|
|
|
.Ar events
|
|
|
|
are available, the function should set the bitmask to match available
|
|
|
|
events and return immediately.
|
|
|
|
Otherwise, the function should block (yield) until some events in
|
|
|
|
.Ar events
|
|
|
|
become available and only then set the
|
|
|
|
.Ar events
|
|
|
|
bitmask and return.
|
|
|
|
.Pp
|
|
|
|
In case this function returns an error,
|
|
|
|
.Dv POLLERR
|
2014-10-18 12:33:23 +04:00
|
|
|
(or its
|
2007-05-18 18:38:15 +04:00
|
|
|
.Xr select 2
|
|
|
|
equivalent) will be delivered to the calling process.
|
2007-07-20 14:01:24 +04:00
|
|
|
.Pp
|
|
|
|
.Em NOTE!
|
|
|
|
The system call interface for
|
|
|
|
.Fn poll
|
|
|
|
contains a timeout parameter.
|
|
|
|
At this level, however, the timeout is not supplied.
|
|
|
|
In case input does not arrive, the file system should periodically
|
|
|
|
unblock and return 0 new events to avoid hanging forever.
|
|
|
|
This will hopefully be better supported by libpuffs in the future.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_mmap "pu" "opc" "flags" "pcr"
|
2007-04-17 14:14:27 +04:00
|
|
|
Called when a regular file is being memory mapped by
|
|
|
|
.Xr mmap 2 .
|
|
|
|
.Fa flags
|
|
|
|
is currently always 0.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_fsync "pu" "opc" "pcr" "flags" "offlo" "offhi"
|
2007-04-17 14:14:27 +04:00
|
|
|
Sychronize a node's contents onto stable storage.
|
|
|
|
This is necessary only if the file server caches some information
|
|
|
|
before committing it.
|
|
|
|
The parameter
|
|
|
|
.Fa flags
|
|
|
|
specifies the minimum level of sychronization required (XXX: they are
|
|
|
|
not yet available).
|
|
|
|
The parameters
|
|
|
|
.Fa offlo
|
|
|
|
and
|
|
|
|
.Fa offhi
|
|
|
|
specify the data offsets requiring to be synced.
|
|
|
|
A high offset of 0 means sync from
|
|
|
|
.Fa offlo
|
|
|
|
to the end of the file.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_seek "pu" "opc" "oldoff" "newoff" "pcr"
|
2007-07-19 12:32:06 +04:00
|
|
|
Test if the node
|
|
|
|
.Ar opc
|
|
|
|
is seekable to the location
|
|
|
|
.Ar newoff .
|
|
|
|
The argument
|
|
|
|
.Ar oldoff
|
|
|
|
specifies the offset we are starting the seek from.
|
|
|
|
Most file systems dealing only with regular will choose to not
|
|
|
|
implement this.
|
|
|
|
However, it is useful for example in cases where files are
|
|
|
|
unseekable streams.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_remove "pu" "opc" "targ" "pcn"
|
|
|
|
.It Fn puffs_node_rmdir "pu" "opc" "targ" "pcn"
|
2007-04-17 14:14:27 +04:00
|
|
|
Remove the node
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa targ
|
2007-04-17 14:14:27 +04:00
|
|
|
from the directory indicated by
|
|
|
|
.Fa opc .
|
|
|
|
The directory entry name to be removed is provided by
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa pcn .
|
2007-04-17 14:14:27 +04:00
|
|
|
The rmdir operation removes only directories, while the remove
|
|
|
|
operation removes all other types except directories.
|
2007-04-16 23:16:02 +04:00
|
|
|
.Pp
|
2007-04-17 14:14:27 +04:00
|
|
|
It is paramount to note that the file system may not remove the
|
|
|
|
node data structures at this point, only the directory entry and prevent
|
|
|
|
lookups from finding the node again.
|
|
|
|
This is to retain the
|
|
|
|
.Ux
|
|
|
|
open file semantics.
|
|
|
|
The data may be removed only when
|
|
|
|
.Fn puffs_node_reclaim
|
2012-08-16 13:25:43 +04:00
|
|
|
or
|
|
|
|
.Fn puffs_node_reclaim2
|
2007-04-17 14:14:27 +04:00
|
|
|
is called for the node, as this assures there are no further users.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_link "pu" "opc" "targ" "pcn"
|
2007-04-17 14:14:27 +04:00
|
|
|
Create a hard link for the node
|
|
|
|
.Fa targ
|
|
|
|
into the directory
|
|
|
|
.Fa opc .
|
|
|
|
The argument
|
|
|
|
.Fa pcn
|
|
|
|
provides the directory entry name for the new link.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_rename "pu" "src_dir" "src" "pcn_src" "targ_dir" "targ" "pcn_targ"
|
2007-04-17 14:14:27 +04:00
|
|
|
Rename the node
|
|
|
|
.Fa src
|
|
|
|
with the name specified by
|
|
|
|
.Fa pcn_src
|
|
|
|
from the directory
|
|
|
|
.Fa src_dir .
|
|
|
|
The target directory and target name are given by
|
|
|
|
.Fa targ_dir
|
|
|
|
and
|
|
|
|
.Fa pcn_targ ,
|
|
|
|
respectively.
|
2009-04-11 19:37:12 +04:00
|
|
|
.Em If
|
2007-07-19 23:25:09 +04:00
|
|
|
the target node already exists, it is specified by
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fa targ
|
|
|
|
and must be replaced atomically.
|
|
|
|
Otherwise
|
|
|
|
.Fa targ
|
|
|
|
is gives as
|
|
|
|
.Dv NULL .
|
|
|
|
.Pp
|
|
|
|
It is legal to replace a directory node by another directory node with
|
|
|
|
the means of rename if the target directory is empty, otherwise
|
|
|
|
.Er ENOTEMPTY
|
|
|
|
should be returned.
|
|
|
|
All other types can replace all other types.
|
|
|
|
In case a rename between incompatible types is attempted, the errors
|
|
|
|
.Er ENOTDIR
|
|
|
|
or
|
|
|
|
.Er EISDIR
|
|
|
|
should be returned, depending on the target type.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_readdir "pu" "opc" "dent" "readoff" "reslen" "pcr" "eofflag" "cookies" "ncookies"
|
2007-04-16 23:16:02 +04:00
|
|
|
To read directory entries,
|
|
|
|
.Fn puffs_node_readdir
|
|
|
|
is called.
|
2007-04-17 17:11:05 +04:00
|
|
|
It should store directories as
|
|
|
|
.Va struct dirent
|
|
|
|
in the space pointed to by
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa dent .
|
|
|
|
The amount of space available is given by
|
|
|
|
.Fa reslen
|
|
|
|
and before returning it should be set to the amount of space
|
|
|
|
.Em remaining
|
|
|
|
in the buffer.
|
|
|
|
The argument
|
|
|
|
.Fa offset
|
|
|
|
is used to specify the offset to the directory.
|
2007-04-17 17:11:05 +04:00
|
|
|
Its intepretation is up to the file system and it should be set to
|
2007-04-16 23:16:02 +04:00
|
|
|
signal the continuation point when there is no more room for the next
|
|
|
|
entry in
|
|
|
|
.Fa dent .
|
|
|
|
It is most performant to return the maximal amount of directory
|
|
|
|
entries each call.
|
2007-04-17 17:11:05 +04:00
|
|
|
It is easiest to generate directory entries by using
|
|
|
|
.Fn puffs_nextdent ,
|
|
|
|
which also automatically advances the necessary pointers.
|
|
|
|
.Pp
|
|
|
|
In case end-of-directory is reached,
|
|
|
|
.Fa eofflag
|
|
|
|
should be set to one.
|
|
|
|
Note that even a new call to readdir may start where
|
|
|
|
.Fa readoff
|
|
|
|
points to end-of-directory.
|
|
|
|
.Pp
|
|
|
|
If the file system supports file handles, the arguments
|
|
|
|
.Fa cookies
|
|
|
|
and
|
|
|
|
.Fa ncookies
|
|
|
|
must be filled out.
|
|
|
|
.Fa cookies
|
2007-08-01 01:48:18 +04:00
|
|
|
is a vector for offsets corresponding to read offsets.
|
2007-04-17 17:11:05 +04:00
|
|
|
One cookie should be filled out for each directory entry.
|
2007-08-01 01:48:18 +04:00
|
|
|
The value of the cookie should equal the offset of the
|
|
|
|
.Em next
|
2012-04-18 18:24:26 +04:00
|
|
|
directory entry, i.e., which offset should be passed to readdir for
|
2007-08-01 01:48:18 +04:00
|
|
|
the first entry read to be the entry following the current one.
|
2007-04-17 17:11:05 +04:00
|
|
|
.Fa ncookies
|
|
|
|
is the number of slots for cookies in the cookie vector upon entry to
|
|
|
|
the function and must be set to the amount of cookies stored in the
|
2012-04-18 18:24:26 +04:00
|
|
|
vector (i.e., amount of directory entries read) upon exit.
|
2007-04-17 17:11:05 +04:00
|
|
|
There is always enough space in the cookie vector for the maximal number
|
|
|
|
of entries that will fit into the directory entry buffer.
|
|
|
|
For filling out the vector, the helper function
|
|
|
|
.Fn PUFFS_STORE_DCOOKIE cookies ncookies offset
|
|
|
|
can be used.
|
|
|
|
This properly checks against
|
|
|
|
.Fa cookies
|
|
|
|
being
|
|
|
|
.Dv NULL .
|
|
|
|
Note that
|
|
|
|
.Fa ncookies
|
|
|
|
must be initialized to zero before the first call to
|
|
|
|
.Fn PUFFS_STORE_DCOOKIE .
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_symlink "pu" "opc" "pni" "pcn_src" "va" "link_target"
|
2007-07-25 12:31:19 +04:00
|
|
|
Create a symbolic link into the directory
|
|
|
|
.Fa opc
|
|
|
|
with the name in
|
|
|
|
.Fa pcn_src
|
|
|
|
and the initial attributes in
|
|
|
|
.Fa va .
|
2007-12-16 22:10:58 +03:00
|
|
|
The argument
|
|
|
|
.Ar link_target
|
|
|
|
contains a null-terminated string for the link target.
|
|
|
|
The created node cookie should be set in
|
2007-07-25 12:31:19 +04:00
|
|
|
.Fa pni .
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_readlink "pu" "opc" "pcr" "link" "linklen"
|
2007-04-17 14:14:27 +04:00
|
|
|
Read the target of a symbolic link
|
|
|
|
.Fa opc .
|
|
|
|
The result is placed in the buffer pointed to by
|
|
|
|
.Fa link .
|
|
|
|
This buffer's length is given in
|
|
|
|
.Fa linklen
|
|
|
|
and it must be updated to reflect the real link length.
|
|
|
|
A terminating nul character should not be put into the buffer and
|
|
|
|
.Em "must not"
|
|
|
|
be included in the link length.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_read "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag"
|
2007-04-17 14:14:27 +04:00
|
|
|
Read the contents of a file
|
|
|
|
.Fa opc .
|
2007-04-16 23:16:02 +04:00
|
|
|
It will gather the data from
|
|
|
|
.Fa offset
|
|
|
|
in the file and read the number
|
|
|
|
.Fa resid
|
|
|
|
octets.
|
|
|
|
The buffer is guaranteed to have this much space.
|
|
|
|
The amount of data requested by
|
|
|
|
.Fa resid
|
|
|
|
should be read, except in the case of eof-of-file or an error.
|
|
|
|
The parameter
|
|
|
|
.Fa resid
|
|
|
|
should be set to indicate the amount of request NOT completed.
|
|
|
|
In the normal case this should be 0.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_write "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag"
|
2012-06-27 17:25:23 +04:00
|
|
|
.It Fn puffs_node_write2 "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag" \
|
|
|
|
"xflag"
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fn puffs_node_write
|
2012-06-27 17:25:23 +04:00
|
|
|
writes data to a file
|
2007-04-17 14:14:27 +04:00
|
|
|
.Fa opc
|
|
|
|
at
|
2007-04-16 23:16:02 +04:00
|
|
|
.Fa offset
|
2007-04-17 14:14:27 +04:00
|
|
|
and extend the file if necessary.
|
2007-04-16 23:16:02 +04:00
|
|
|
The number of octets written is indicated by
|
|
|
|
.Fa resid ;
|
|
|
|
everything must be written or an error will be generated.
|
|
|
|
The parameter must be set to indicate the amount of data NOT written.
|
2012-06-27 17:25:23 +04:00
|
|
|
In case the ioflag
|
2007-04-16 23:16:02 +04:00
|
|
|
.Dv PUFFS_IO_APPEND
|
|
|
|
is specified, the data should be appended to the end of the file.
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fn puffs_node_write2
|
|
|
|
serves the same purpose as
|
|
|
|
.Fn puffs_node_write
|
2012-06-28 00:30:52 +04:00
|
|
|
with an additional
|
2012-06-27 17:25:23 +04:00
|
|
|
.Fa xflag
|
|
|
|
in which
|
|
|
|
.Dv PUFFS_WRITE_FAF
|
|
|
|
is set for Fire-And-Forget operations.
|
2014-10-31 16:56:04 +03:00
|
|
|
.It Fn puffs_node_fallocate "pu" "opc" "pos" "len"
|
2014-10-31 17:01:16 +03:00
|
|
|
Allocate
|
2014-10-31 16:56:04 +03:00
|
|
|
.Fa len
|
|
|
|
bytes of backing store at offset
|
|
|
|
.Fa pos
|
|
|
|
for the node referenced by the cookie
|
|
|
|
.Fa opc .
|
|
|
|
.It Fn puffs_node_fdiscard "pu" "opc" "pos" "len"
|
|
|
|
Free
|
|
|
|
.Fa len
|
|
|
|
bytes of backing store (creating a hole) at offset
|
|
|
|
.Fa pos
|
|
|
|
for the node referenced by the cookie
|
|
|
|
.Fa opc .
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_print "pu" "opc"
|
2009-04-11 20:48:53 +04:00
|
|
|
Print information about node.
|
|
|
|
This is used only for kernel-initiated diagnostic purposes.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_reclaim "pu" "opc"
|
2007-04-17 14:14:27 +04:00
|
|
|
The kernel will no longer reference the cookie and resources associated
|
|
|
|
with it may be freed.
|
|
|
|
In case the file
|
|
|
|
.Fa opc
|
|
|
|
has a link count of zero, it may be safely removed now.
|
2012-08-16 13:25:43 +04:00
|
|
|
.It Fn puffs_node_reclaim2 "pu" "opc" "nlookup"
|
|
|
|
Same as
|
2012-08-16 15:28:38 +04:00
|
|
|
.Fn puffs_node_reclaim
|
2012-08-16 13:25:43 +04:00
|
|
|
with an addditional argument for the number of lookups that have been done
|
|
|
|
on the node (Node creation is counted as a lookup). This can be used by the
|
2015-02-16 13:48:56 +03:00
|
|
|
file system to avoid a race condition, where the kernel sends a reclaim
|
2012-08-16 15:28:38 +04:00
|
|
|
while it does not have received the reply for a lookup.
|
2015-02-16 13:48:56 +03:00
|
|
|
If the file system tracks lookup count, and compares to
|
2012-08-16 13:25:43 +04:00
|
|
|
.Fa nlookup
|
2012-08-16 15:28:38 +04:00
|
|
|
it can detect this situation and ignore the reclaim.
|
2012-08-16 13:25:43 +04:00
|
|
|
.Pp
|
2015-02-16 13:48:56 +03:00
|
|
|
If the file system maps cookies to
|
2012-08-16 13:25:43 +04:00
|
|
|
.Vt struct puffs_node
|
2012-08-16 15:28:38 +04:00
|
|
|
then the framework will do that work, and
|
2012-08-16 13:25:43 +04:00
|
|
|
.Fn puffs_node_reclaim
|
|
|
|
can be reliabily used without the race condition.
|
2010-12-13 12:06:51 +03:00
|
|
|
.It Fn puffs_node_abortop "pu" "opc" "pcn"
|
2012-04-18 18:24:26 +04:00
|
|
|
In case the operation following lookup (e.g., mkdir or remove) is not
|
2010-12-13 12:06:51 +03:00
|
|
|
executed for some reason, abortop will be issued.
|
|
|
|
This is useful only for servers which cache state between lookup
|
|
|
|
and a directory operation and is generally left unimplemented.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_node_inactive "pu" "opc"
|
2007-04-17 14:14:27 +04:00
|
|
|
The node
|
|
|
|
.Fa opc
|
|
|
|
has lost its last reference in the kernel.
|
2007-04-16 23:16:02 +04:00
|
|
|
However, the cookie must still remain valid until
|
|
|
|
.Fn puffs_node_reclaim
|
2012-08-16 13:25:43 +04:00
|
|
|
or
|
|
|
|
.Fn puffs_node_reclaim2
|
2007-04-16 23:16:02 +04:00
|
|
|
is called.
|
2007-11-30 22:02:28 +03:00
|
|
|
.It Fn puffs_setback "pcc" "op"
|
2007-05-09 17:46:16 +04:00
|
|
|
Issue a "setback" operation which will be handled when the request response
|
|
|
|
is returned to the kernel.
|
|
|
|
Currently this can be only called from mmap, open, remove and rmdir.
|
|
|
|
The valid parameters for
|
|
|
|
.Ar op
|
|
|
|
are
|
|
|
|
.Dv PUFFS_SETBACK_INACT_N1
|
|
|
|
and
|
|
|
|
.Dv PUFFS_SETBACK_INACT_N2 .
|
|
|
|
These signal that a file system mounted with
|
|
|
|
.Dv PUFFS_KFLAG_IAONDEMAND
|
|
|
|
should call the file system inactive method for the specified node.
|
|
|
|
The node number 1 always means the operation cookie
|
|
|
|
.Ar opc ,
|
|
|
|
while the node number 2 can be used to specify the second node argument
|
2012-04-18 18:24:26 +04:00
|
|
|
present in some methods, e.g., remove.
|
2007-07-06 02:37:52 +04:00
|
|
|
.It Fn puffs_newinfo_setcookie pni cookie
|
|
|
|
Set cookie for node provided by this method to
|
|
|
|
.Ar cookie .
|
|
|
|
.It Fn puffs_newinfo_setvtype pni vtype
|
|
|
|
Set the type of the newly located node to
|
|
|
|
.Ar vtype .
|
|
|
|
This call is valid only for
|
|
|
|
.Fn lookup
|
|
|
|
and
|
|
|
|
.Fn fhtonode .
|
|
|
|
.It Fn puffs_newinfo_setsize pni size
|
|
|
|
Set the size of the newly located node to
|
|
|
|
.Ar size .
|
|
|
|
If left unset, the value defaults to 0.
|
|
|
|
This call is valid only for
|
|
|
|
.Fn lookup
|
|
|
|
and
|
|
|
|
.Fn fhtovp .
|
|
|
|
.It Fn puffs_newinfo_setrdev pni rdev
|
|
|
|
Set the type of the newly located node to
|
2007-07-19 23:25:09 +04:00
|
|
|
.Ar vtype .
|
2007-07-06 02:37:52 +04:00
|
|
|
This call is valid only for
|
|
|
|
.Fn lookup
|
|
|
|
and
|
|
|
|
.Fn fhtovp
|
|
|
|
producing device type nodes.
|
2012-04-18 04:57:21 +04:00
|
|
|
.It Fn puffs_newinfo_setva pni vap
|
2012-04-18 18:24:26 +04:00
|
|
|
Set the attributes for newly created vnode.
|
|
|
|
This call is valid for
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fn lookup ,
|
|
|
|
.Fn create ,
|
|
|
|
.Fn mkdir ,
|
|
|
|
.Fn mknod ,
|
|
|
|
and
|
|
|
|
.Fn symlink ,
|
|
|
|
if
|
|
|
|
.Fn puffs_init
|
2012-04-18 18:24:26 +04:00
|
|
|
was called with
|
2012-04-18 04:57:21 +04:00
|
|
|
.Dv PUFFS_KFLAG_CACHE_FS_TTL
|
|
|
|
flag set.
|
|
|
|
.It Fn puffs_newinfo_setvattl pni va_ttl
|
2012-04-18 18:24:26 +04:00
|
|
|
Set cached attribute time to live for newly created vnode.
|
|
|
|
This call is valid for
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fn lookup ,
|
|
|
|
.Fn create ,
|
|
|
|
.Fn mkdir ,
|
|
|
|
.Fn mknod ,
|
|
|
|
and
|
|
|
|
.Fn symlink ,
|
|
|
|
if
|
|
|
|
.Fn puffs_init
|
2012-04-18 18:24:26 +04:00
|
|
|
was called with
|
2012-04-18 04:57:21 +04:00
|
|
|
.Dv PUFFS_KFLAG_CACHE_FS_TTL
|
|
|
|
flag set.
|
|
|
|
.It Fn puffs_newinfo_setcnttl pni cn_ttl
|
2012-04-18 18:24:26 +04:00
|
|
|
Set cached name time to live for newly created vnode.
|
|
|
|
This call is valid for
|
2012-04-18 04:57:21 +04:00
|
|
|
.Fn lookup ,
|
|
|
|
.Fn create ,
|
|
|
|
.Fn mkdir ,
|
|
|
|
.Fn mknod ,
|
|
|
|
and
|
|
|
|
.Fn symlink ,
|
|
|
|
if
|
|
|
|
.Fn puffs_init
|
2012-04-18 18:24:26 +04:00
|
|
|
was called with
|
2012-04-18 04:57:21 +04:00
|
|
|
.Dv PUFFS_KFLAG_CACHE_FS_TTL
|
|
|
|
flag set.
|
2007-04-17 14:14:27 +04:00
|
|
|
.El
|
2007-04-16 23:16:02 +04:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr puffs 3 ,
|
|
|
|
.Xr vfsops 9 ,
|
|
|
|
.Xr vnodeops 9
|