diff options
Diffstat (limited to 'share')
49 files changed, 4787 insertions, 3 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 3f4b8b6a396c..3fbdaf971e63 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,10 +1,21 @@ -# $Id$ +# $Id: Makefile,v 1.20 1997/02/22 13:26:21 peter Exp $ MAN9= MD5.9 at_shutdown.9 at_fork.9 at_exit.9 boot.9 cd.9 copy.9 \ devfs_add_devswf.9 \ devfs_link.9 fetch.9 ifnet.9 intro.9 panic.9 psignal.9 rtalloc.9 \ rtentry.9 scsiconf.9 sd.9 sleep.9 spl.9 st.9 store.9 style.9 \ - timeout.9 uio.9 + timeout.9 uio.9 \ + vnode.9 vget.9 vput.9 vref.9 vrele.9 VOP_ABORTOP.9 VOP_ACCESS.9 \ + VOP_ADVLOCK.9 VOP_ATTRIB.9 VOP_BLKATOFF.9 VOP_BWRITE.9 VOP_CREATE.9 \ + VOP_FSYNC.9 VOP_GETPAGES.9 VOP_INACTIVE.9 VOP_IOCTL.9 VOP_LINK.9 \ + VOP_LOCK.9 VOP_LOOKUP.9 VOP_MMAP.9 VOP_OPENCLOSE.9 \ + VOP_PATHCONF.9 VOP_PRINT.9 VOP_RDWR.9 VOP_READDIR.9 \ + VOP_READLINK.9 VOP_REALLOCBLKS.9 VOP_REMOVE.9 VOP_RENAME.9 \ + VOP_SEEK.9 VOP_SELECT.9 VOP_STRATEGY.9 VOP_TRUNCATE.9 \ + VOP_UPDATE.9 VOP_VALLOC.9 VFS.9 VFS_FHTOVP.9 VFS_INIT.9 \ + VFS_MOUNT.9 VFS_QUOTACTL.9 VFS_ROOT.9 VFS_START.9 VFS_STATFS.9 \ + VFS_SYNC.9 VFS_UNMOUNT.9 VFS_VGET.9 VFS_VPTOFH.9 + MLINKS+= MD5.9 MD5Init.9 MD5.9 MD5Transform.9 MLINKS+= copy.9 copyin.9 copy.9 copyout.9 copy.9 copystr.9 copy.9 copyinstr.9 @@ -22,6 +33,21 @@ MLINKS+= spl.9 splstatclock.9 spl.9 spltty.9 spl.9 splvm.9 MLINKS+= spl.9 spl0.9 spl.9 splx.9 MLINKS+= store.9 subyte.9 store.9 susword.9 store.9 suswintr.9 store.9 suword.9 MLINKS+= timeout.9 untimeout.9 -MLINKS+= uio.9 uiomove.9 +MLINKS+= vref.9 VREF.9 +MLINKS+= VOP_CREATE.9 VOP_MKNOD.9 +MLINKS+= VOP_CREATE.9 VOP_MKDIR.9 +MLINKS+= VOP_CREATE.9 VOP_SYMLINK.9 +MLINKS+= VOP_ATTRIB.9 VOP_SETATTR.9 +MLINKS+= VOP_ATTRIB.9 VOP_GETATTR.9 +MLINKS+= VOP_OPENCLOSE.9 VOP_OPEN.9 +MLINKS+= VOP_OPENCLOSE.9 VOP_CLOSE.9 +MLINKS+= VOP_RDWR.9 VOP_READ.9 +MLINKS+= VOP_RDWR.9 VOP_WRITE.9 +MLINKS+= VOP_REMOVE.9 VOP_RMDIR.9 +MLINKS+= VOP_INACTIVE.9 VOP_RECLAIM.9 +MLINKS+= VOP_LOCK.9 VOP_UNLOCK.9 +MLINKS+= VOP_LOCK.9 VOP_ISLOCKED.9 +MLINKS+= VOP_VALLOC.9 VOP_VFREE.9 +MLINKS+= VOP_GETPAGES.9 VOP_PUTPAGES.9 .include <bsd.prog.mk> diff --git a/share/man/man9/VFS.9 b/share/man/man9/VFS.9 new file mode 100644 index 000000000000..1d98d445ef43 --- /dev/null +++ b/share/man/man9/VFS.9 @@ -0,0 +1,42 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS 9 +.Sh NAME +.Nm VFS +.Nd kernel interface to filesystems +.Sh DESCRIPTION +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_FHTOVP.9 b/share/man/man9/VFS_FHTOVP.9 new file mode 100644 index 000000000000..7b39fb2e13f1 --- /dev/null +++ b/share/man/man9/VFS_FHTOVP.9 @@ -0,0 +1,92 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_FHTOVP 9 +.Sh NAME +.Nm VFS_FHTOVP +.Nd turn an NFS filehandle into a vnode +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_FHTOVP "struct mount *mp" "struct fid *fhp" "struct mbuf *nam" "struct vnode **vpp" "int *exflagsp" "struct ucred **credanonp" +.Sh DESCRIPTION +This is used by the NFS server to turn an NFS filehandle into a vnode. +.Pp +Its arguments are: +.Bl -tag -width credanonp +.It Ar mp +The filesystem. +.It Ar fhp +The filehandle to convert. +.It Ar nam +An mbuf containing the network address of the client. +.It Ar vpp +Return parameter for the new locked vnode. +.It Ar exflagsp +Return parameter for the export flags for this client. +.It Ar credanonp +Return parameter for the anonymous credentials for this client. +.El +.Pp +The contents of the filehandle are defined by the filesystem and are +not examined by any other part of the system. It should contain +enough information to uniquely identify a file within the filesystem +as well as noticing when a file has been removed and the filesystem +resources have been reused for a new file. For instance, UFS +filesystem stores the inode number and inode generation counter in its +filehandle. +.Pp +The filesystem should call +.Xr vfs_export_lookup 9 +with the address of an appropriate +.Dv netexport +structure and the address of the client, +.Fa nam , +to verify that the client can access this filesystem. +.Sh RETURN VALUES +The locked vnode for the file will be returned in +.Fa *vpp . +The export flags and anonymous credentials specific to the client +(returned by +.Xr vfs_export_lookup 9 ) +will be returned in +.Fa *exflagsp +and +.Fa *credanonp . +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 , +.Xr VFS_VPTOFH 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_INIT.9 b/share/man/man9/VFS_INIT.9 new file mode 100644 index 000000000000..2934b360c7af --- /dev/null +++ b/share/man/man9/VFS_INIT.9 @@ -0,0 +1,52 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_INIT 9 +.Sh NAME +.Nm VFS_INIT +.Nd initialise a filesystem +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_INIT +.Sh DESCRIPTION +This function is called once to allow a filesystem to initialise any +global data structures that it might have. It is either called when +the operating system boots or, for dynamically loaded filesystems, +when the kernel module containing the filesystem is loaded. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_MOUNT.9 b/share/man/man9/VFS_MOUNT.9 new file mode 100644 index 000000000000..f83728c3da19 --- /dev/null +++ b/share/man/man9/VFS_MOUNT.9 @@ -0,0 +1,87 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_MOUNT 9 +.Sh NAME +.Nm VFS_MOUNT +.Nd mount a filesystem +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_MOUNT "struct mount *mp" "char *path" "caddr_t data" "struct nameidata *ndp" "struct proc *p" +.Sh DESCRIPTION +Mount a filesystem into the system's namespace. +.Pp +Its arguments are: +.Bl -tag -width data +.It Ar mp +Structure representing the filesystem. +.It Ar path +Pathname where the filesystem is being mounted. +.It Ar data +Filesystem specific data. This should be read into the kernel using +.Xr copyin 9 . +.It Ar ndp +Contains the result of a +.Xr namei 9 +call on the pathname of the mountpoint. +.It Ar p +Process which is mounting the filesystem. +.El +.Pp +This is called both to mount new filesystems and to change the +attributes of an existing filesystem. If the +.Dv MNT_UPDATE +flag is set in +.Fa mp->mnt_flag +then the filesystem should update its internal state from the value of +.Fa mp->mnt_flag . +This can be used, for instance, to convert a read-only filesystem to +read-write. It is also used by +.Xr mountd 8 +to update the NFS export information for the filesystem. +.Pp +If the +.Dv MNT_UPDATE +flag is not specified, then this is a newly mounted filesystem. The +filesystem code should allocate and initialise +any private data needed to represent +the filesystem (it can use the +.Fa mp->mnt_data +field to store this information). +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_QUOTACTL.9 b/share/man/man9/VFS_QUOTACTL.9 new file mode 100644 index 000000000000..addf3612bcd4 --- /dev/null +++ b/share/man/man9/VFS_QUOTACTL.9 @@ -0,0 +1,51 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_QUOTACTL 9 +.Sh NAME +.Nm VFS_QUOTACTL +.Nd manipulate filesystem quotas +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_QUOTACTL "struct mount *mp" "int cmds" "uid_t uid" "caddr_t arg" "struct proc *p" +.Sh DESCRIPTION +Implement filesystem quotas. See +.Xr quotactl 2 +for a description of the arguments. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr quotactl 2 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_ROOT.9 b/share/man/man9/VFS_ROOT.9 new file mode 100644 index 000000000000..2808ae69b026 --- /dev/null +++ b/share/man/man9/VFS_ROOT.9 @@ -0,0 +1,57 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_ROOT 9 +.Sh NAME +.Nm VFS_ROOT +.Nd return the root vnode of a filesystem +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_ROOT "struct mount *mp" "struct vnode **vpp" +.Sh DESCRIPTION +Return a locked vnode for the root directory of the filesystem. +.Pp +Its arguments are: +.Bl -tag -width vpp +.It Ar mp +The filesystem. +.It Ar vpp +Return parameter for the root vnode. +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_START.9 b/share/man/man9/VFS_START.9 new file mode 100644 index 000000000000..e7e551b69fc5 --- /dev/null +++ b/share/man/man9/VFS_START.9 @@ -0,0 +1,60 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_START 9 +.Sh NAME +.Nm VFS_START +.Nd make a filesystem operational +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_START "struct mount *mp" "int flags" "struct proc *p" +.Sh DESCRIPTION +This is called after +.Xr VFS_MOUNT 9 +and before the first access to the filesystem. +Its arguments are: +.Bl -tag -width flags +.It Ar mp +The filesystem. +.It Ar flags +?? +.It Ar p +Process which is starting the filesystem. +.El +.Sh SEE ALSO +.Xr vnode 9 +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_STATFS.9 b/share/man/man9/VFS_STATFS.9 new file mode 100644 index 000000000000..e36c8a7d821d --- /dev/null +++ b/share/man/man9/VFS_STATFS.9 @@ -0,0 +1,60 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_STATFS 9 +.Sh NAME +.Nm VFS_STATFS +.Nd return filesystem status +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_STATFS "struct mount *mp" "struct statfs *sbp" "struct proc *p" +.Sh DESCRIPTION +This call returns various pieces of information about the filesystem, +including recommended I/O sizes, free space, free inodes, etc. +.Pp +Its arguments are: +.Bl -tag -width sbp +.It Ar mp +The filesystem. +.It Ar sbp +Return parameter for the filesystem's status. +.It Ar p +The process which is querying the filesystem. +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_SYNC.9 b/share/man/man9/VFS_SYNC.9 new file mode 100644 index 000000000000..e678f1649bdd --- /dev/null +++ b/share/man/man9/VFS_SYNC.9 @@ -0,0 +1,68 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_SYNC 9 +.Sh NAME +.Nm VFS_SYNC +.Nd flush unwritten data +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_SYNC "struct mount *mp" "int waitfor" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +This writes out all unwritten data in a filesystem. +.Pp +Its arguments are: +.Bl -tag -width sbp +.It Ar mp +The filesystem. +.It Ar waitfor +Whether the function should wait for I/O to complete. +.It Ar cred +The caller's credentials. +.It Ar p +The calling process. +.El +.Pp +This would normally call +.Xr VOP_FSYNC 9 +for all the vnodes in the filesystem. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 , +.Xr VOP_FSYNC 9 , +.Xr sync 2 , +.Xr fsync 2 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_UNMOUNT.9 b/share/man/man9/VFS_UNMOUNT.9 new file mode 100644 index 000000000000..bb102b00f681 --- /dev/null +++ b/share/man/man9/VFS_UNMOUNT.9 @@ -0,0 +1,64 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_UNMOUNT 9 +.Sh NAME +.Nm VFS_UNMOUNT +.Nd unmount a filesystem +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_UNMOUNT "struct mount *mp" "int mntflags" "struct proc *p" +.Sh DESCRIPTION +Unmount a filesystem. +.Pp +Its arguments are: +.Bl -tag -width mntflags +.It Ar mp +The filesystem. +.It Ar mntflags +Various flags. +.It Ar p +Process which is unmounting the filesystem. +.El +.Pp +If the +.Dv MNT_FORCE +flag is specified then open files should be forcibly closed. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 , +.Xr vflush 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_VGET.9 b/share/man/man9/VFS_VGET.9 new file mode 100644 index 000000000000..8e4c25e9d80d --- /dev/null +++ b/share/man/man9/VFS_VGET.9 @@ -0,0 +1,69 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_VGET 9 +.Sh NAME +.Nm VFS_VGET +.Nd convert an inode number to a vnode +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_VGET "struct mount *mp" "ino_t ino" "struct vnode **vpp" +.Sh DESCRIPTION +This converts an inode number into a locked vnode. +.Pp +Its arguments are: +.Bl -tag -width ino +.It Ar mp +The filesystem. +.It Ar ino +The inode representing the file. +.It Ar vpp +Return parameter for the vnode. +.El +.Pp +This is an optional filesystem entrypoint for filesystems which have a +unique id number for every file in the filesystem. It is used +internally by the UFS filesystem and also by the NFSv3 server to +implement the +.Dv READDIRPLUS +nfs call. +.Pp +If the filesystem does not support this call, then it should return +.Dv EOPNOTSUPP . +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VFS_VPTOFH.9 b/share/man/man9/VFS_VPTOFH.9 new file mode 100644 index 000000000000..a3ad2ea08fb3 --- /dev/null +++ b/share/man/man9/VFS_VPTOFH.9 @@ -0,0 +1,60 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_VPTOFH 9 +.Sh NAME +.Nm VFS_VPTOFH +.Nd turn a vnode into an NFS filehandle +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_VPTOFH "struct vnode *vp" "struct fid *fhp" +.Sh DESCRIPTION +This is used by the NFS server to create an opaque filehandle which +uniquely identifies the file and which can be used by an NFS client +to access the file in the future. +.Pp +Its arguments are: +.Bl -tag -width fhp +.It Ar vp +The vnode to make a filehandle for. +.It Ar fhp +Return parameter for the filehandle. +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 , +.Xr VFS_FHTOVP +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_ABORTOP.9 b/share/man/man9/VOP_ABORTOP.9 new file mode 100644 index 000000000000..0434dca1cab8 --- /dev/null +++ b/share/man/man9/VOP_ABORTOP.9 @@ -0,0 +1,71 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_ABORTOP 9 +.Sh NAME +.Nm VOP_ABORTOP +.Nd abort a directory operation +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_ABORTOP "struct vnode *dvp" "struct componentname *cnp" +.Sh DESCRIPTION +This is called after +.Xr namei 9 +when a +.Dv CREATE / +.Dv DELETE +isn't actually done. +If a buffer has been saved in anticipation of a +.Dv CREATE , +delete it. +.Bl -tag -width dvp +.It Ar dvp +the vnode of the directory +.It At cnp +pathname information for the aborted operation +.El +.Sh PSEUDOCODE +.Bd -literal +int +vop_abortop(struct vnode *dvp, struct componentname *cnp) +{ + if ((cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) + free(cnp->cn_pnbuf, M_NAMEI); + + return 0; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ACCESS.9 b/share/man/man9/VOP_ACCESS.9 new file mode 100644 index 000000000000..6a53d358bf40 --- /dev/null +++ b/share/man/man9/VOP_ACCESS.9 @@ -0,0 +1,146 @@ +.\" -*- nroff -*- +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_ACCESS 9 +.Sh NAME +.Nm VOP_ACCESS +.Nd check access permissions of a file or unix domain socket +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_ACCESS "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +This entry point checks the access permissions of the file against the +given credentials. +.Pp +Its arguments are: +.Bl -tag -width mode +.It Ar vp +the vnode of the file to check +.It Ar mode +the type of access required +.It Ar cred +the user credentials to check +.It Ar p +the process which is checking +.El +.Pp +The +.Fa mode +is a mask which can contain +.Dv VREAD , +.Dv VWRITE or +.Dv VEXEC. +.Sh LOCKS +The vnode should be locked on entry. +.Sh RETURN VALUES +If the file is accessable in the specified way, then zero is returned, +otherwise an appropriate error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_access(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + int error; + + /* + * Disallow write attempts on read-only file systems; + * unless the file is a socket, fifo, or a block or + * character device resident on the file system. + */ + if (mode & VWRITE) { + switch (vp->v_type) { + case VDIR: + case VLNK: + case VREG: + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return EROFS; + + break; + } + } + + /* If immutable bit set, nobody gets to write it. */ + if ((mode & VWRITE) && vp has immutable bit set) + return EPERM; + + /* Otherwise, user id 0 always gets access. */ + if (cred->cr_uid == 0) + return 0; + + mask = 0; + + /* Otherwise, check the owner. */ + if (cred->cr_uid == owner of vp) { + if (mode & VEXEC) + mask |= S_IXUSR; + if (mode & VREAD) + mask |= S_IRUSR; + if (mode & VWRITE) + mask |= S_IWUSR; + return (((mode of vp) & mask) == mask ? 0 : EACCES); + } + + /* Otherwise, check the groups. */ + for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) + if (group of vp == *gp) { + if (mode & VEXEC) + mask |= S_IXGRP; + if (mode & VREAD) + mask |= S_IRGRP; + if (mode & VWRITE) + mask |= S_IWGRP; + return (((mode of vp) & mask) == mask ? 0 : EACCES); + } + + /* Otherwise, check everyone else. */ + if (mode & VEXEC) + mask |= S_IXOTH; + if (mode & VREAD) + mask |= S_IROTH; + if (mode & VWRITE) + mask |= S_IWOTH; + return (((mode of vp) & mask) == mask ? 0 : EACCES); +} +.Ed +.Sh ERRORS +.Bl -tag -width EACCESS +.It Bq Er EPERM +An attempt was made to change an immutable file +.It Bq Er EACCES +Permission denied +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ADVLOCK.9 b/share/man/man9/VOP_ADVLOCK.9 new file mode 100644 index 000000000000..6dd65d375f6c --- /dev/null +++ b/share/man/man9/VOP_ADVLOCK.9 @@ -0,0 +1,69 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_ADVLOCK 9 +.Sh NAME +.Nm VOP_ADVLOCK +.Nd advisory record locking +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/fcntl.h> +.Fd #include <sys/lockf.h> +.Ft int +.Fn VOP_ADVLOCK "struct vnode *vp" "caddr_t id" "int op" "struct flock *fl" "int flags" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width flags +.It Ar vp +the vnode being manipulated +.It Ar id +the process changing the lock +.It Ar op +the operation to perform +.It Ar fl +description of the lock +.It Ar flags +??? +.El +.Pp +This entry point manipulates advisory record locks on the file. Most +filesystems delegate the work for this call to +.Xr lf_advlock 9 . +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr flock 2 , +.Xr fcntl 2 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_ATTRIB.9 b/share/man/man9/VOP_ATTRIB.9 new file mode 100644 index 000000000000..ec9752b9513b --- /dev/null +++ b/share/man/man9/VOP_ATTRIB.9 @@ -0,0 +1,149 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_ATTRIB 9 +.Sh NAME +.Nm VOP_GETATTR , +.Nm VOP_SETATTR +.Nd get and set attributes on a file or directory +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_GETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p" +.Ft int +.Fn VOP_SETATTR "struct vnode *vp" "struct vattr *vap" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +These entry points manipulate various attributes of a file or directory, +including file permissions, owner, group, size, +access time and modification time. +.Pp +The arguments are: +.Bl -tag -width cred +.It Ar vp +the vnode of the file +.It Ar vpp +the attributes of the file +.It Ar cred +the user credentials of the calling process +.It Ar p +the process +.El +.Pp +Attributes which are not being modified by +.Xr VOP_SETATTR 9 +should be set to the value +.Dv VNOVAL . +.Sh LOCKS +The file should not be locked on entry. +.Sh RETURN VALUES +.Xr VOP_GETATTR 9 +returns information about the file in +.Fa *vap . +.Xr VOP_SETATTR 9 +returns zero if the attributes were changed successfully, otherwise an +appropriate error is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_getattr(struct vnode *vp, struct vattr *vpp, + struct ucred *cred, struct proc *p) +{ + /* + * Fill in the contents of *vpp with information from + * the filesystem. + */ + ...; + + return 0; +} + +int +vop_setattr(struct vnode *vp, struct vattr *vpp, + struct ucred *cred, struct proc *p) +{ + /* + * Check for unsettable attributes. + */ + if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) || + (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) || + (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) || + ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) { + return (EINVAL); + } + + if (vap->va_flags != VNOVAL) { + /* + * Set the immutable and append flags of the file. + */ + } + + if (vap->va_uid != (uid_t)VNOVAL || vap->va_gid != (gid_t)VNOVAL) { + /* + * Change owner and/or group of the file. + */ + } + + if (vap->va_size != VNOVAL) { + /* + * Truncate the file to the specified size. + */ + } + + if (vap->va_atime.ts_sec != VNOVAL || vap->va_mtime.ts_sec != VNOVAL) { + /* + * Change access and/or modification time of file. + */ + } + + if (vap->va_mode != (mode_t)VNOVAL) { + /* + * Change permissions of file. + */ + } + + return 0; +} +.Ed +.Sh ERRORS +.Bl -tag -width EACCES +.It Bq Er EPERM +The file is immutable +.It Bq Er EACCES +Permission denied +.It Bq Er EROFS +The filesystem is readonly +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_ACCESS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_BLKATOFF.9 b/share/man/man9/VOP_BLKATOFF.9 new file mode 100644 index 000000000000..143a52439ebf --- /dev/null +++ b/share/man/man9/VOP_BLKATOFF.9 @@ -0,0 +1,71 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_BLKATOFF 9 +.Sh NAME +.Nm VOP_BLKATOFF +.Nd return a filesystem buffer for part of a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/buf.h> +.Ft int +.Fn VOP_BLKATOFF "struct vnode *vp" "off_t offset" "char **res" "struct buf **bpp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width offset +.It Ar vp +The vnode representing the file. +.It Ar offset +The byte offset into the file where the buffer should start. +.It Ar res +Return parameter for a pointer to the last valid byte in the buffer. +.It Ar bpp +Return parameter for the buffer. +.El +.Pp +Return buffer with the contents of block +.Fa offset +from the beginning of file +.Fa ip . +.Fa res +is non-zero, fill it in with a pointer to the +remaining space in the directory. +.Pp +This call is only used internally by the UFS filesystem. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr buf 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_BWRITE.9 b/share/man/man9/VOP_BWRITE.9 new file mode 100644 index 000000000000..6ed435d3912a --- /dev/null +++ b/share/man/man9/VOP_BWRITE.9 @@ -0,0 +1,57 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_BWRITE 9 +.Sh NAME +.Nm VOP_BWRITE +.Nd write a filesystem buffer +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/buf.h> +.Ft int +.Fn VOP_BWRITE "struct buf *bp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width bp +.It Ar bp +the buffer to be written +.El +.Pp +Most filesystems use the default implementation of this, +.Fn vn_bwrite . +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_CREATE.9 b/share/man/man9/VOP_CREATE.9 new file mode 100644 index 000000000000..9a63b012180f --- /dev/null +++ b/share/man/man9/VOP_CREATE.9 @@ -0,0 +1,194 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_CREATE 9 +.Sh NAME +.Nm VOP_CREATE , +.Nm VOP_MKNOD , +.Nm VOP_MKDIR , +.Nm VOP_SYMLINK +.Nd create a file, socket, fifo, device, directory or symlink +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/namei.h> +.Ft int +.Fn VOP_CREATE "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" +.Ft int +.Fn VOP_MKNOD "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" +.Ft int +.Fn VOP_MKDIR "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" +.Fn VOP_SYMLINK "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" "struct vattr *vap" "char *target" +.Sh DESCRIPTION +These entry points create a new file, socket, fifo, device, directory or symlink +in a given directory. +.Pp +The arguments are: +.Bl -tag -width target +.It Ar dvp +the locked vnode of the directory +.It Ar vpp +the address of a variable where the resulting locked vnode should be stored +.It Ar cnp +the pathname component created +.It Ar vap +the attributes that the new object should be created with +.It Ar target +the pathname of the target of the symlink +.El +.Pp +These entry points are called after +.Xr VOP_LOOKUP 9 +when an object is being created. +Normally, +.Xr VOP_LOOKUP 9 +will have set the +.Dv SAVENAME +flag in +.Fa cnp->cn_flags +to keep the memory pointed to by +.Fa cnp->cn_pnbuf +valid. +If an error is detected when creating the file, +then this memory will be freed. +If the file is created successfully, then it will be freed unless the +.Dv SAVESTART +flag is specified in +.Fa cnp . +.Sh LOCKS +The directory, +.Fa dvp +should be locked on entry and will be unlocked and released on exit. +If the call is successful, the new object will be returned locked, +unless the call is +.Xr VOP_MKNOD 9 +or +.Xr VOP_SYMLINK 9 +in which case the new object is not returned at all. +It is not clear why +.Xr VOP_MKNOD 9 +and +.Xr VOP_SYMLINK 9 +need a +.Fa *vpp +argument at all. +.Sh RETURN VALUES +If successful, the vnode for the new object is placed in +.Fa *vpp +and zero is returned. Otherwise, an appropriate error is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_create(struct vnode *dvp, + struct vnode **vpp, + struct componentname *cnp + struct vattr *vap) +{ + int mode = MAKEIMODE(vap->va_type, vap->va_mode); + struct vnode *vp; + int error; + + *vpp = NULL; + if ((mode & IFMT) == 0) + mode |= IFREG; + + error = VOP_VALLOC(dvp, mode, cnp->cn_cred, &vp); + if (error) { + free(cnp->cn_pnbuf, M_NAMEI); + vput(dvp); + return error; + } + + /* + * Update the permissions for the new vnode, including + * copying the group from the directory. + */ + ...; + +#ifdef QUOTA + /* + * Possibly check quota information. + */ + ...; +#endif + + /* + * Enter new vnode in directory, taking care that the vnode + * hits the disk before the directory contents are changed. + */ + error = ...; + + if (error) + goto bad; + + if ((cnp->cn_flags & SAVESTART) == 0) + free(cnp->cn_pnbuf, M_NAMEI); + vput(dvp); + *vpp = vp; + + return 0; + +bad: + /* + * Write error occurred trying to update the inode + * or the directory so must deallocate the inode. + */ + free(cnp->cn_pnbuf, M_NAMEI); + vput(vp); + + /* + * Deallocate filesystem resources for vp. + */ + ...; + + vput(dvp); + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width EDQUOT +.It Bq Er ENOSPC +The filesystem is full. +.It Bq Er EDQUOT +Quota exceeded. +.El +.Sh SEE ALSO +.Xr VOP_LOOKUP 9 , +.Xr VOP_VALLOC 9 +.Sh HISTORY +The function +.Nm +appeared in 4.3BSD. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_FSYNC.9 b/share/man/man9/VOP_FSYNC.9 new file mode 100644 index 000000000000..fcd78f7bac70 --- /dev/null +++ b/share/man/man9/VOP_FSYNC.9 @@ -0,0 +1,140 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_FSYNC 9 +.Sh NAME +.Nm VOP_FSYNC +.Nd flush filesystem buffers for a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_FSYNC "struct vnode *vp" "struct ucred *cred" "int waitfor" "struct proc *p" +.Sh DESCRIPTION +This call flushes any dirty filesystem buffers for the file. +It is used to implement the +.Xr sync 2 +and +.Xr fsync 2 +system calls. +.Pp +Its arguments are: +.Bl -tag -width waitfor +.It Ar vp +the vnode of the file +.It Ar cred +the caller's credentials +.It Ar waitfor +whether the function should wait for I/O to complete +.It Ar p +the calling process +.El +.Pp +The argument +.Fa waitfor +is either +.Dv MNT_WAIT +or +.Dv MNT_NOWAIT +and specifies whether or not the function should wait for the writes +to finish before returning. +.Sh LOCKS +The file should be locked on entry. +.Sh RETURN VALUES +Zero is returned if the call is successful, otherwise an appropriate +error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_fsync(struct vnode *vp, struct ucred *cred, int waitfor, struct proc *p) +{ + struct buf *bp; + struct buf *nbp; + struct timeval tv; + int s; + +loop: + s = splbio(); + for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) { + nbp = bp->b_vnbufs.le_next; + + /* + * Ignore buffers which are already being written. + */ + if (bp->b_flags & B_BUSY) + continue; + + /* + * Make sure the buffer is dirty. + */ + if ((bp->b_flags & B_DELWRI) == 0) + panic("vop_fsync: not dirty"); + + vfs_bio_awrite(bp); + splx(s); + goto loop; + } + splx(s); + + if (waitfor == MNT_WAIT) { + s = splbio(); + while (vp->v_numoutput) { + vp->v_flag |= VBWAIT; + tsleep((caddr_t)&vp->v_numoutput, PRIBIO + 1, "vopfsn"); + } + splx(s); +#ifdef DIAGNOSTIC + if (vp->v_dirtyblkhd.lh_first) { + vprint("vop_fsync: dirty", vp); + goto loop; + } +#endif + } + + /* + * Write out the on-disc version of the vnode. + */ + tv = time; + return VOP_UPDATE(vp, &tv, &tv, waitfor == MNT_WAIT); +} +.Ed +.Sh ERRORS +.Bl -tag -width ENOSPC +.It Bq Er ENOSPC +The filesystem is full. +.It Bq Er EDQUOT +Quota exceeded. +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_GETPAGES.9 b/share/man/man9/VOP_GETPAGES.9 new file mode 100644 index 000000000000..a161e41107d9 --- /dev/null +++ b/share/man/man9/VOP_GETPAGES.9 @@ -0,0 +1,72 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_GETPAGES 9 +.Sh NAME +.Nm VOP_GETPAGES , +.Nm VOP_PUTPAGES +.Nd read or write VM pages from a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <vm/vm.h> +.Ft int +.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int reqpage" "vm_ooffset_t offset" +.Ft int +.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *m" "int count" "int sync" "int *rtvals" "vm_ooffset_t offset" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width reqpage +.It Ar vp +The file to access. +.It Ar m +A page ??? +.It Ar count +How many pages to access. +.It Ar sync +Nonzero if the write should be synchronous. +.It Ar rtvals +??? +.It Ar reqpage +??? +.It Ar offset +Offset in the file to start accessing. +.El +.Pp +Not quite sure about this one. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_INACTIVE.9 b/share/man/man9/VOP_INACTIVE.9 new file mode 100644 index 000000000000..c04c10daa858 --- /dev/null +++ b/share/man/man9/VOP_INACTIVE.9 @@ -0,0 +1,95 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_INACTIVE 9 +.Sh NAME +.Nm VOP_INACTIVE , +.Nm VOP_RECLAIM +.Nd reclaim filesystem resources for a vnode +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_INACTIVE "struct vnode *vp" +.Ft int +.Fn VOP_RECLAIM "struct vnode *vp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width vp +.It Ar vp +the vnode being reclaimed +.El +.Pp +.Xr VOP_INACTIVE 9 +is called when the kernel is no longer using the vnode. This may be +because the reference count reaches zero or it may be that the +filesystem is being forcibly unmounted while there are open files. +It can be used to reclaim space for 'open but deleted' files. +.Xr VOP_RECLAIM 9 +is called when a vnode is being reused for a different filesystem. +Any filesystem specific resources associated with the vnode should be +freed. +.Sh PSEUDOCODE +.Bd -literal +int +vop_inactive(struct vnode *vp) +{ + if (link count of vp == 0) { + /* + * Reclaim space in filesystem for vp. + */ + ...; + } + + return 0; +} + +int +vop_reclaim(struct vnode *vp) +{ + /* + * Clean out the name cache. + */ + cache_purge(vp); + + /* + * Free filesystem-related data. + */ + ...; + + return 0; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_IOCTL.9 b/share/man/man9/VOP_IOCTL.9 new file mode 100644 index 000000000000..352179c4e269 --- /dev/null +++ b/share/man/man9/VOP_IOCTL.9 @@ -0,0 +1,78 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_IOCTL 9 +.Sh NAME +.Nm VOP_IOCTL +.Nd device specific control +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_IOCTL "struct vnode *vp" "int command" "caddr_t data" "int fflag" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +Manipulate a file in device dependant ways. +.Pp +Its arguments are: +.Bl -tag -width command +.It Ar vp +the vnode of the file (normally representing a device) +.It Ar command +the device specific operation to perform +.It Ar cnp +extra data for the specified operation +.It Ar fflag +some flags ??? +.It Ar cred +the caller's credentials +.It Ar p +the calling process +.El +.Pp +Most filesystems do not implement this entry point. +.Sh LOCKS +The file should not be locked on entry. +.Sh RETURN VALUES +If successful, zero is returned, otherwise an appropriate error code. +.Sh PSEUDOCODE +.Bd -literal +int +vop_ioctl(struct vnode *vp, int command, caddr_t data, int fflag, + struct ucred *cred, struct proc *p) +{ + return EOPNOTSUPP; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_LINK.9 b/share/man/man9/VOP_LINK.9 new file mode 100644 index 000000000000..ecac98f7fc96 --- /dev/null +++ b/share/man/man9/VOP_LINK.9 @@ -0,0 +1,124 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_LINK 9 +.Sh NAME +.Nm VOP_LINK +.Nd create a new name for a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_LINK "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" +.Sh DESCRIPTION +This links a new name in the specified directory to an existing file. +.Pp +Its arguments are: +.Bl -tag -width 8X +.It Ar dvp +the vnode of the directory +.It At vp +the vnode of the file to be linked +.It Ar cnp +pathname information about the file +.El +.Pp +The directory vnode is unlocked and released on exit. +.Sh LOCKS +The directory, +.Fa dvp +should be locked on entry and will be unlocked and released on exit. +The file +.Fa vp +should not be locked. +.Sh RETURN VALUES +Zero is returned if the file was linked successfully, otherwise an +error is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_link(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + int error = 0; + + if (vp->v_mount != dvp->v_mount) { + VOP_ABORTOP(dvp, cnp); + error = EXDEV; + goto out2; + } + if (vp != dvp && (error = VOP_LOCK(vp))) { + VOP_ABORTOP(dvp, cnp); + goto out2; + } + + if (vp would have too many links) { + VOP_ABORTOP(dvp, cnp); + error = EMLINK; + goto out1; + } + + if (vp is immutable) { + VOP_ABORTOP(dvp, cnp); + error = EPERM; + goto out1; + } + + /* + * Increment link count of vp and write back the on-disc version of it. + */ + ...; + + if (!error) { + /* + * Add the new name to the directory. + */ + ...; + } + + free(cnp->cn_pnbuf, M_NAMEI); +out1: + if (vp != dvp) + VOP_UNLOCK(vp); +out2: + vput(dvp); + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width EPERM +.It Bq Er EPERM +the file is immutable +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_LOCK.9 b/share/man/man9/VOP_LOCK.9 new file mode 100644 index 000000000000..03cf51e35fc9 --- /dev/null +++ b/share/man/man9/VOP_LOCK.9 @@ -0,0 +1,129 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_LOCK 9 +.Sh NAME +.Nm VOP_LOCK , +.Nm VOP_UNLOCK , +.Nm VOP_ISLOCKED +.Nd serialize access to a vnode +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_LOCK "struct vnode *vp" +.Ft int +.Fn VOP_UNLOCK "struct vnode *vp" +.Ft int +.Fn VOP_ISLOCKED "struct vnode *vp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width vp +.It Ar vp +the vnode being locked or unlocked +.El +.Pp +These calls are used to serialise access to the filesystem, for +instance to prevent two writes to the same file from happening at the +same time. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh PSEUDOCODE +.Bd -literal +struct vopnode { + int von_flag; + /* + * Other filesystem specific data. + */ + ...; +}; +#define VON_LOCKED 1 +#define VON_WANTED 2 +#define VTOVON(vp) ((struct vopnode *) (vp)->v_data) + +int +vop_lock(struct vnode *vp) +{ + struct vopnode* vop; + +start: + while (vp->v_flag & VXLOCK) { + vp->v_flag |= VXWANT; + tsleep((caddr_t)vp, PINOD, "voplk1", 0); + } + if (vp->v_tag == VT_NON) + return ENOENT; + + vop = VTOVON(vp); + if (vop->von_flag & VON_LOCKED) { + vop->von_flag |= VON_WANTED; + tsleep((caddr_t) vop, PINOD, "voplk2", 0); + goto start; + } + + vop->von_flag |= VON_LOCKED; + + return 0; +} + +int +vop_unlock(struct vnode *vp) +{ + struct vopnode *vop = VTOVON(vp); + + if ((vop->von_flag & VON_LOCKED) == 0) { + panic("vop_unlock not locked"); + } + vop->von_flag &= ~VON_LOCKED; + if (vop->von_flag & VON_WANTED) { + vop->von_flag &= ~VON_WANTED; + wakeup((caddr_t) vop); + } + + return 0; +} + +int +vop_islocked(struct vnode *vp) +{ + struct vopnode *vop = VTOVON(vp); + + if (vop->von_flag & VON_LOCKED) + return 1; + else + return 0; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_LOOKUP.9 b/share/man/man9/VOP_LOOKUP.9 new file mode 100644 index 000000000000..c878e39022d4 --- /dev/null +++ b/share/man/man9/VOP_LOOKUP.9 @@ -0,0 +1,447 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os FreeBSD +.Dt VOP_LOOKUP 9 +.Sh NAME +.Nm VOP_LOOKUP +.Nd lookup a component of a pathname +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/namei.h> +.Ft int +.Fn VOP_LOOKUP "struct vnode *dvp" "struct vnode **vpp" "struct componentname *cnp" +.Sh DESCRIPTION +This VFS entry point looks up a single pathname component in a given directory. +.Pp +Its arguments are: +.Bl -tag -width vpp +.It Ar dvp +the locked vnode of the directory to search +.It Ar vpp +the address of a variable where the resulting locked vnode should be stored +.It Ar cnp +the pathname component to be searched for +.El +.Pp +.Fa Cnp +is a pointer to a componentname structure defined as follows: +.Bd -literal +struct componentname { + /* + * Arguments to lookup. + */ + u_long cn_nameiop; /* namei operation */ + u_long cn_flags; /* flags to namei */ + struct proc *cn_proc; /* process requesting lookup */ + struct ucred *cn_cred; /* credentials */ + /* + * Shared between lookup and commit routines. + */ + char *cn_pnbuf; /* pathname buffer */ + char *cn_nameptr; /* pointer to looked up name */ + long cn_namelen; /* length of looked up component */ + u_long cn_hash; /* hash value of looked up name */ + long cn_consume; /* chars to consume in lookup() */ +}; +.Ed +.Pp +Convert a component of a pathname into a pointer to a locked vnode. +This is a very central and rather complicated routine. +If the file system is not maintained in a strict tree hierarchy, +this can result in a deadlock situation. +.Pp +The +.Fa cnp->cn_nameiop +argument is +.Dv LOOKUP , +.Dv CREATE , +.Dv RENAME , +or +.Dv DELETE +depending on the intended use of the object. +When +.Dv CREATE , +.Dv RENAME , +or +.Dv DELETE +is specified, information usable in +creating, renaming, or deleting a directory entry may be calculated. +.Pp +Overall outline of VOP_LOOKUP: +.Bd -filled -offset indent +Check accessibility of directory. +Look for name in cache, if found, then return name. +Search for name in directory, goto to found or notfound as appropriate. +.Ed +.Pp +notfound: +.Bd -filled -offset indent +If creating or renaming and at end of pathname, +return +.Dv EJUSTRETURN , +leaving info on available slots else return +.Dv ENOENT . +.Ed +.Pp +found: +.Bd -filled -offset indent +If at end of path and deleting, return information to allow delete. +If at end of path and renaming, lock target +inode and return info to allow rename. +If not at end, add name to cache; if at end and neither creating +nor deleting, add name to cache. +.Ed +.Sh LOCKS +The directory, +.Fa dvp +should be locked on entry. +If an error (note: the return value +.Dv EJUSTRETURN +is not considered an error) +is detected, it will be returned locked. +Otherwise, it will be unlocked unless both +.Dv LOCKPARENT +and +.Dv ISLASTCN +are specified in +.Fa cnp->cn_flags . +If an entry is found in the directory, it will be returned locked. +.Sh RETURN VALUES +Zero is returned with +.Fa *vpp +set to the locked vnode of the file if the component is found. +If the component being searched for is ".", then the vnode just has +an extra reference added to it with +.Xr vref 9 . +The caller must take care to release the locks appropriately in this +case. +.Pp +If the component is not found and the operation is +.Dv CREATE +or +.Dv RENAME , +the flag +.Dv ISLASTCN +is specified and the operation would succeed, the special return value +.Dv EJUSTRETURN +is returned. +Otherwise, an appropriate error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_lookup(struct vnode *dvp, + struct vnode **vpp, + struct componentname *cnp) +{ + int error; + int nameiop = cnp->cn_nameiop; + int flags = cnp->cn_flags; + int lockparent = flags & LOCKPARENT; + int islastcn = flags & ISLASTCN; + struct vnode *vp = NULL; + + /* + * Check accessiblity of directory. + */ + if (dvp->v_type != VDIR) + return ENOTDIR; + + error = VOP_ACCESS(dvp, VEXEC, cred, cnp->cn_proc); + if (error) + return (error); + + if (islastcn && (dvp->v_mount->mnt_flag & MNT_RDONLY) && + (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME)) + return (EROFS); + + /* + * Check name cachec for directory/name pair. This returns ENOENT + * if the name is known not to exist, -1 if the name was found, or + * zero if not. + */ + error = cache_lookup(dvp, vpp, cnp); + if (error) { + int vpid; + + if (error = ENOENT) + return error; + + vp = *vpp; + if (dvp == vp) { /* lookup on "." */ + VREF(vp); + error = 0; + } else if (flags & ISDOTDOT) { + /* + * We need to unlock the directory before getting + * the locked vnode for ".." to avoid deadlocks. + */ + VOP_UNLOCK(dvp); + error = vget(vp, 1); + if (!error) { + if (lockparent && islastcn) + error = VOP_LOCK(dvp); + } + } else { + error = vget(vp, 1); + if (error || !(lockparent && islastcn)) { + VOP_UNLOCK(dvp); + } + } + + /* + * Check that the capability number did not change + * while we were waiting for the lock. + */ + if (!error) { + if (vpid == vp->v_id) { + /* + * dvp is locked if lockparent && islastcn. + * vp is locked. + */ + return (0); + } + vput(vp); + + if (dvp != vp && lockparent && islastcn) + VOP_UNLOCK(pdp); + } + + /* + * Re-lock dvp for the directory search below. + */ + error = VOP_LOCK(dvp); + if (error) { + return (error); + } + + *vpp = NULL; + } + + /* + * Search dvp for the component cnp->cn_nameptr. + */ + ...; + + if (!found) { + if ((nameiop == CREATE || nameiop == RENAME) + && islastcn + && directory dvp has not been removed) { + /* + * Check for write access on directory. + */ + + /* + * Possibly record the position of a slot in the directory + * large enough for the new component name. This can be + * recorded in the vnode private data for dvp. + * Set the SAVENAME flag to hold onto the pathname for use + * later in VOP_CREATE or VOP_RENAME. + */ + cnp->cn_flags |= SAVENAME; + if (!lockparent) + /* + * Note that the extra data recorded above is only + * useful if lockparent is specified. + */ + VOP_UNLOCK(dvp); + + return EJUSTRETURN; + } + + /* + * Consider inserting name into cache. + */ + if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE) + cache_enter(dvp, NULL, cnp); + + return ENOENT; + } else { + /* + * If deleting, and at end of pathname, return parameters + * which can be used to remove file. If the wantparent flag + * isn't set, we return only the directory, otherwise we go on + * and lock the inode, being careful with ".". + */ + if (nameiop == DELETE && islastcn) { + /* + * Check for write access on directory. + */ + error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_proc); + if (error) + return (error); + + if (found entry is same as dvp) { + VREF(dvp); + *vpp = dvp; + return 0; + } + + error = VFS_VGET(dvp->v_mount, ..., &vp); + if (error) + return error; + + if (directory is sticky + && cred->cr_uid != 0 + && cred->cr_uid != owner of dvp + && owner of vp != cred->cr_uid) { + vput(vp); + return EPERM; + } + *vpp = vp; + if (!lockparent) + VOP_UNLOCK(dvp); + + return 0; + } + + /* + * If rewriting (RENAME), return the inode and the + * information required to rewrite the present directory + * Must get inode of directory entry to verify it's a + * regular file, or empty directory. + */ + if (nameiop == RENAME && wantparent && islastcn) { + error = VOP_ACCESS(dvp, VWRITE, cred, cnp->cn_proc); + if (error) + return (error); + + /* + * Check for "." + */ + if (found entry is same as dvp) + return EISDIR; + + error = VFS_VGET(dvp->v_mount, ..., &vp); + if (error) + return error; + *vpp = vp; + /* + * Save the name for use in VOP_RENAME later. + */ + cnp->cn_flags |= SAVENAME; + if (!lockparent) + VOP_UNLOCK(dvp); + + return 0; + } + + /* + * Step through the translation in the name. We do not `vput' the + * directory because we may need it again if a symbolic link + * is relative to the current directory. Instead we save it + * unlocked as "pdp". We must get the target inode before unlocking + * the directory to insure that the inode will not be removed + * before we get it. We prevent deadlock by always fetching + * inodes from the root, moving down the directory tree. Thus + * when following backward pointers ".." we must unlock the + * parent directory before getting the requested directory. + * There is a potential race condition here if both the current + * and parent directories are removed before the VFS_VGET for the + * inode associated with ".." returns. We hope that this occurs + * infrequently since we cannot avoid this race condition without + * implementing a sophisticated deadlock detection algorithm. + * Note also that this simple deadlock detection scheme will not + * work if the file system has any hard links other than ".." + * that point backwards in the directory structure. + */ + if (flags & ISDOTDOT) { + VOP_UNLOCK(dvp); /* race to get the inode */ + error = VFS_VGET(dvp->v_mount, ..., &vp); + if (error) { + VOP_LOCK(dvp); + return (error); + } + if (lockparent && islastcn) { + error = VOP_LOCK(dvp); + if (error) { + vput(vp); + return error; + } + } + *vpp = vp; + } else if (found entry is same as dvp) { + VREF(dvp); /* we want ourself, ie "." */ + *vpp = dvp; + } else { + error = VFS_VGET(dvp->v_mount, ..., &vp); + if (error) + return (error); + if (!lockparent || !islastcn) + VOP_UNLOCK(dvp); + *vpp = vp; + } + + /* + * Insert name into cache if appropriate. + */ + if (cnp->cn_flags & MAKEENTRY) + cache_enter(dvp, *vpp, cnp); + return (0); + } +} +.Ed +.Sh ERRORS +.Bl -tag -width EJUSTRETURN +.It Bq Er ENOTDIR +The vnode +.Fa dvp +does not represent a directory. +.It Bq Er ENOENT +The component +.Fa dvp +was not found in this directory. +.It Bq Er EACCESS +access for the specified operation is denied. +.It Bq Er EJUSTRETURN +a +.Dv CREATE +or +.Dv RENAME +operation would be successful +.El +.Sh SEE ALSO +.Xr VOP_ACCESS 9 , +.Xr VOP_CREATE 9 , +.Xr VOP_MKNOD 9 , +.Xr VOP_MKDIR 9 , +.Xr VOP_SYMLINK 9 , +.Xr VOP_RENAME 9 , +.Xr VOP_ABORTOP 9 +.Sh HISTORY +The function +.Nm +appeared in 4.3BSD. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson, with some text from +comments in ufs_lookup.c. diff --git a/share/man/man9/VOP_MMAP.9 b/share/man/man9/VOP_MMAP.9 new file mode 100644 index 000000000000..9f51aa54f782 --- /dev/null +++ b/share/man/man9/VOP_MMAP.9 @@ -0,0 +1,70 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_MMAP 9 +.Sh NAME +.Nm VOP_MMAP +.Nd map a file into memory +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_MMAP "struct vnode *vp" "int fflags" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +Map the contents of a file into memory using the VM system. +.Pp +Its arguments are: +.Bl -tag -width fflags +.It Ar vp +the vnode of the file +.It Ar fflags +some flags ??? +.It Ar cred +the caller's credentials +.It Ar p +the calling process +.El +.Pp +Most filesystems do not implement this entry point. +.Sh PSEUDOCODE +.Bd -literal +int +vop_mmap(struct vnode *vp, int fflags, + struct ucred *cred, struct proc *p) +{ + return EINVAL; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_OPENCLOSE.9 b/share/man/man9/VOP_OPENCLOSE.9 new file mode 100644 index 000000000000..2e35615a8bb6 --- /dev/null +++ b/share/man/man9/VOP_OPENCLOSE.9 @@ -0,0 +1,90 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_OPEN 9 +.Sh NAME +.Nm VOP_OPEN , +.Nm VOP_CLOSE +.Nd open or close a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_OPEN "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" +.Ft int +.Fn VOP_CLOSE "struct vnode *vp" "int mode" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +The +.Xr VOP_OPEN 9 +entry point is called before a file is accessed by a process and the +.Xr VOP_CLOSE 9 +entry point is called after a file is finished with by the process. +.Pp +The arguments are: +.Bl -tag -width mode +.It Ar vp +the vnode of the file +.It Ar mode +the access mode required by the calling process +.It Ar p +the process which is accessing the file +.El +The access mode is a set of flags, including +.Dv FREAD , +.Dv FWRITE , +.Dv O_NONBLOCK , +.Dv O_APPEND . +.Sh LOCKS +The vnode +.Fa vp +should be locked on entry and will still be locked on exit for +.Xr VOP_OPEN 9 +and unlocked on entry and exit for +.Xr VOP_CLOSE 9 . +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_open(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) +{ + /* + * Most filesystems don't do much here. + */ + return 0; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_LOOKUP 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_PATHCONF.9 b/share/man/man9/VOP_PATHCONF.9 new file mode 100644 index 000000000000..1f7641de93d0 --- /dev/null +++ b/share/man/man9/VOP_PATHCONF.9 @@ -0,0 +1,88 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_PATHCONF 9 +.Sh NAME +.Nm VOP_PATHCONF +.Nd return POSIX pathconf information +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/unistd.h> +.Ft int +.Fn VOP_PATHCONF "struct vnode *vp" "int name" "int *retval" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width retval +.It Ar vp +the vnode to get information about +.It Ar name +the type of information to return +.It Ar retval +the place to return the information +.El +.Pp +The value of +.Fa name +specifies what should be returned: +.Bl -tag -width _PC_CHOWN_RESTRICTED +.It Dv _PC_LINK_MAX +The maximum number of links to a file. +.It Dv _PC_NAME_MAX +The maximum number of bytes in a file name. +.It Dv _PC_PATH_MAX +The maximum number of bytes in a pathname. +.It Dv _PC_PIPE_BUF +The maximum number of bytes which will be written atomically to a pipe. +.It Dv _PC_CHOWN_RESTRICTED +Return 1 if appropriate privileges are required for the +.Xr chown 2 +system call, otherwise 0. +.It Dv _PC_NO_TRUNC +Return 1 if file names longer than +.Dv KERN_NAME_MAX +are truncated. +.El +.Sh RETURN VALUES +If +.Fa name +is recognised, +.Fa *retval +is set to the specified value and zero is returned, otherwise +.Dv EINVAL +is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr pathconf 2 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_PRINT.9 b/share/man/man9/VOP_PRINT.9 new file mode 100644 index 000000000000..42fec12c84fb --- /dev/null +++ b/share/man/man9/VOP_PRINT.9 @@ -0,0 +1,54 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_PRINT 9 +.Sh NAME +.Nm VOP_PRINT +.Nd print debugging information +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_PRINT "struct vnode *vp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width bp +.It Ar vp +the vnode to print +.El +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_RDWR.9 b/share/man/man9/VOP_RDWR.9 new file mode 100644 index 000000000000..61c0635997c0 --- /dev/null +++ b/share/man/man9/VOP_RDWR.9 @@ -0,0 +1,226 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_RDWR 9 +.Sh NAME +.Nm VOP_READ , +.Nm VOP_WRITE +.Nd read or write a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/uio.h> +.Ft int +.Fn VOP_READ "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" +.Ft int +.Fn VOP_WRITE "struct vnode *vp" "struct uio *uio" "int ioflag" "struct ucred *cred" +.Sh DESCRIPTION +These entry points read or write the contents of a file +.Pp +The arguments are: +.Bl -tag -width ioflag +.It Ar vp +the vnode of the file +.It Ar uio +the location of the data to be read or written +.It Ar ioflag +various flags +.It Ar cnp +the credentials of the caller +.El +.Pp +The +.Fa ioflag +argument is a bit mask which can contain the following flags: +.Bl -tag -width IO_NODELOCKED +.It Dv IO_UNIT +do I/O as atomic unit +.It Dv IO_APPEND +append write to end +.It Dv IO_SYNC +do I/O syncronously +.It Dv IO_NODELOCKED +underlying node already locked +.It Dv IO_NDELAY +.Dv FNDELAY +flag set in file table +.It Dv IO_VMIO +data alread in VMIO space +.El +.Sh LOCKS +The file should be locked on entry and will still be locked on exit. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_read(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) +{ + struct buf *bp; + off_t bytesinfile; + daddr_t lbn, nextlbn; + long size, xfersize, blkoffset; + int error; + + size = block size of filesystem; + + for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { + bytesinfile = size of file - uio->uio_offset; + if (bytesinfile <= 0) + break; + + lbn = uio->uio_offset / size; + blkoffset = uio->uio_offset - lbn * size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (bytesinfile < xfersize) + xfersize = bytesinfile; + + error = bread(vp, lbn, size, NOCRED, &bp); + if (error) { + brelse(bp); + bp = NULL; + break; + } + + /* + * We should only get non-zero b_resid when an I/O error + * has occurred, which should cause us to break above. + * However, if the short read did not cause an error, + * then we want to ensure that we do not uiomove bad + * or uninitialized data. + */ + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) + break; + xfersize = size; + } + + error = uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio); + if (error) + break; + + bqrelse(bp); + } + if (bp != NULL) + bqrelse(bp); + + return error; +} + +int +vop_write(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) +{ + struct buf *bp; + off_t bytesinfile; + daddr_t lbn, nextlbn; + off_t osize; + long size, resid, xfersize, blkoffset; + int flags; + int error; + + osize = size of file; + size = block size of filesystem; + resid = uio->uio_resid; + if (ioflag & IO_SYNC) + flags = B_SYNC; + else + flags = 0; + + for (error = 0; uio->uio_resid > 0;) { + lbn = uio->uio_offset / size; + blkoffset = uio->uio_offset - lbn * size; + + xfersize = size - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + + if (uio->uio_offset + xfersize > size of file) + vnode_pager_setsize(vp, uio->uio_offset + xfersize); + + if (size > xfersize) + flags |= B_CLRBUF; + else + flags &= ~B_CLRBUF; + + error = find_block_in_file(vp, lbn, blkoffset + xfersize, + cred, &bp, flags); + if (error) + break; + + if (uio->uio_offset + xfersize > size of file) + set size of file to uio->uio_offset + xfersize; + + error = uiomove((char *)bp->b_data + blkoffset, (int) xfersize, uio); + /* XXX ufs does not check the error here. Why? */ + + if (ioflag & IO_VMIO) + bp->b_flags |= B_RELBUF; /* ??? */ + + if (ioflag & IO_SYNC) + bwrite(bp); + else if (xfersize + blkoffset == size) + bawrite(bp); + else + bdwrite(bp); + + if (error || xfersize == 0) + break; + } + + if (error) { + if (ioflag & IO_UNIT) { + VOP_TRUNCATE(vp, osize, ioflag & IO_SYNC, cred, uio->uio_procp); + uio->uio_offset -= resid - uio->uio_resid; + uio->uio_resid = resid; + } + } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { + struct timeval tv; + error = VOP_UPDATE(vp, &tv, &tv, 1); /* XXX what does this do? */ + } + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width ENOSPC +.It Bq Er ENOSPC +The filesystem is full. +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr uiomove 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_READDIR.9 b/share/man/man9/VOP_READDIR.9 new file mode 100644 index 000000000000..05b0edaaf47a --- /dev/null +++ b/share/man/man9/VOP_READDIR.9 @@ -0,0 +1,165 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_READDIR 9 +.Sh NAME +.Nm VOP_READDIR +.Nd read contents of a directory +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/dirent.h> +.Ft int +.Fn VOP_READDIR "struct vnode *vp" "struct uio *uio" "struct ucred *cred" "int *eofflag" "int *ncookies" "u_int **cookies" +.Sh DESCRIPTION +Read directory entries. +.Bl -tag -width ncookies +.It Ar vp +the vnode of the directory +.It Ar uio +where to read the directory contents +.It Ar cred +the caller's credentials +.It Ar eofflag +return end of file status (NULL if not wanted) +.It Ar ncookies +number of directory cookies generated for NFS (NULL if not wanted) +.It Ar cookies +directory seek cookies generated for NFS (NULL if not wanted) +.El +The directory contents are read into +.Dv struct dirent +structures. If the on-disc data structures differ from this then they +should be translated. +.Sh LOCKS +The directory should be locked on entry and will still be locked on exit. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Pp +If this is called from the NFS server, the extra arguments +.Fa eofflag , +.Fa ncookies +and +.Fa cookies +are given. +The value of +.Fa *eofflag +should be set to TRUE if the end of the directory is reached while +reading. +The directory seek cookies are returned to the NFS client and may be used +later to restart a directory read part way through the directory. +There should be one cookie returned per directory entry. The value of +the cookie should be the offset within the directory where the on-disc +version of the appropriate directory entry starts. +Memory for the cookies should be allocated using: +.Pp +.Bd -literal + ...; + *ncookies = number of entries read; + *cookies = (u_int*)# + malloc(*ncookies * sizeof(u_int), M_TEMP, M_WAITOK); +.Ed +.Sh PSEUDOCODE +.Bd -literal +int +vop_readdir(struct vnode *vp, struct uio *uio, struct ucred *cred, + int *eofflag, int *ncookies, u_int **cookies) +{ + off_t off; + int error = 0; + + /* + * Remember the original offset to use later in generating cookies. + */ + off = uio->uio_offset; + + /* + * Read directory contents starting at uio->uio_offset into buffer + * pointed to by uio. + */ + ...; + + if (!error && ncookies != NULL) { + struct dirent *dpStart; + struct dirent *dpEnd; + struct dirent *dp; + int count; + u_int *cookiebuf; + u_int *cookiep; + + if (uio->uio_segflg != UIO_SYSSPACE || uio->uio_iovcnt != 1) + panic("vop_readdir: unexpected uio from NFS server"); + + /* + * Parse the stuff just read into the uio. + */ + dpStart = (struct dirent *) + (uio->uio_iov->iov_base - (uio->uio_offset - off)); + dpEnd = (struct dirent *) uio->uio_iov->iov_base; + + /* + * Count number of entries. + */ + for (dp = dpStart, count = 0; + dp < dpEnd; + dp = (struct dirent *)((caddr_t) dp + dp->d_reclen)) + count++; + + cookiebuf = (u_int *) malloc(count * sizeof(u_int), M_TEMP, M_WAITOK); + for (dp = dpStart; cookiep = cookiebuf; + dp < dpEnd; + dp = (struct dirent *)((caddr_t) dp + dp->d_reclen)) { + off += dp->d_reclen; + *cookiep++ = (u_int) off; + } + *ncookies = count; + *cookies = cookiebuf; + } + + if (eofflag && uio->uio_offset is past the end of the directory) { + *eofflag = TRUE; + } + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width EINVAL +.It Bq Er EINVAL +attempt to read from an illegal offset in the directory +.It Bq Er EIO +a read error occurred while reading the directory +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_READLINK.9 b/share/man/man9/VOP_READLINK.9 new file mode 100644 index 000000000000..c66964b5e027 --- /dev/null +++ b/share/man/man9/VOP_READLINK.9 @@ -0,0 +1,80 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_READLINK 9 +.Sh NAME +.Nm VOP_READLINK +.Nd read the target of a symbolic link +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/uio.h> +.Ft int +.Fn VOP_READLINK "struct vnode *vp" "struct uio *uio" "struct ucred *cred" +.Sh DESCRIPTION +This reads the target pathname of a symbolic link +.Bl -tag -width uio +.It Ar vp +the vnode of the symlink +.It Ar uio +the location of the data to be read or written +.It Ar cnp +the credentials of the caller +.El +.Sh LOCKS +The vnode should be locked on entry and will still be locked on exit. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_readlink(struct vnode *vp, struct uio *uio, struct ucred *cred) +{ + int error = 0; + + /* + * Read the target of the symlink. + */ + ...; + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width EIO +.It Bq Er EIO +a read error occurred while reading the contents of the symlink +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr uiomove 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_REALLOCBLKS.9 b/share/man/man9/VOP_REALLOCBLKS.9 new file mode 100644 index 000000000000..75571a18f79c --- /dev/null +++ b/share/man/man9/VOP_REALLOCBLKS.9 @@ -0,0 +1,60 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_REALLOCBLKS 9 +.Sh NAME +.Nm VOP_REALLOCBLKS +.Nd rearrange blocks in a file to be contiguous +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/buf.h> +.Ft int +.Fn VOP_REALLOCBLKS "struct vnode *vp" "struct cluster_save *buflist" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width buflist +.It Ar vp +the file to manipulate +.It Ar buflist +a list of buffers to rearrange +.El +.Pp +This seems to be part of a work in progress. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr buf 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_REMOVE.9 b/share/man/man9/VOP_REMOVE.9 new file mode 100644 index 000000000000..c0adbe28d866 --- /dev/null +++ b/share/man/man9/VOP_REMOVE.9 @@ -0,0 +1,107 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_REMOVE 9 +.Sh NAME +.Nm VOP_REMOVE , +.Nm VOP_RMDIR +.Nd remove a file or directory +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_REMOVE "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" +.Ft int +.Fn VOP_RMDIR "struct vnode *dvp" "struct vnode *vp" "struct componentname *cnp" +.Sh DESCRIPTION +These entry points remove files and directories respectively. +.Pp +The arguments are: +.Bl -tag -width dvp +.It Ar dvp +the vnode of the directory +.It Ar vp +the vnode of the file to be removed +.It Ar cnp +pathname information about the file +.El +.Sh LOCKS +Both +.Fa dvp +and +.Fa vp +should be locked on entry and are unlocked and released on exit. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error code is returned. +.Sh PSEUDOCODE +.Bd -literal +int +vop_remove(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + int error = 0; + + if (vp is immutable) { + error = EPERM; + goto out; + } + + /* + * Remove name cnp->cn_nameptr from directory and update link count + * of vp. + */ + ...; + + /* + * Careful about trying to remove ".". XXX this should be handled + * higher up. + */ + if (dvp == vp) + vrele(vp); + else + vput(vp); + vput(dvp); + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width ENOTEMPTY +.It Bq Er EPERM +the file is immutable +.It Bq Er ENOTEMPTY +attempt to remove a directory which is not empty +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_LOOKUP 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_RENAME.9 b/share/man/man9/VOP_RENAME.9 new file mode 100644 index 000000000000..889c51c21e20 --- /dev/null +++ b/share/man/man9/VOP_RENAME.9 @@ -0,0 +1,306 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_RENAME 9 +.Sh NAME +.Nm VOP_RENAME +.Nd rename a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_RENAME "struct vnode *fdvp" "struct vnode *fvp" "struct componentname *fcnp" "struct vnode *tdvp" "struct vnode *tvp" "struct componentname *tcnp" +.Sh DESCRIPTION +This renames a file and possibly changes its parent directory. +If the destination object exists, it will be removed first. +.Pp +Its arguments are: +.Bl -tag -width fdvp +.It Ar fdvp +the vnode of the old parent directory +.It Ar fvp +the vnode of the file to be renameed +.It Ar fcnp +pathname information about the file's current name +.It Ar tdvp +the vnode of the new parent directory +.It Ar tvp +the vnode of the target file (if it exists) +.It Ar tcnp +pathname information about the file's new name +.El +.Sh LOCKS +The destination directory and file (if it exists) should be locked on entry. +The source directory and file +will be released on exit. +The destination directory and file (if it exists) will be unlocked +and released on exit. +.Sh PSEUDOCODE +.Bd -literal +int +vop_rename(struct vnode *fdvp, struct vnode *fvp, struct componentname *fcnp, + struct vnode *tdvp, struct vnode *tvp, struct componentname *tcnp) +{ + int doingdirectory = 0; + int error = 0; + + /* + * Check for cross-device rename. + */ + if (fvp->v_mount != tdvp->v_mount) { + error = EXDEV; + abortit: + VOP_ABORTOP(tdvp, tcnp); + if (tdvp == tvp) + vrele(tdvp); + else + vput(tdvp); + if (tvp) + vput(tvp); + VOP_ABORTOP(fdvp, fcnp); + vrele(fdvp); + vrele(fvp); + return error; + } + + if (tvp exists and is immutable) { + error = EPERM; + goto abortit; + } + + /* + * Check if just deleting a link name. + */ + if (fvp == tvp) { + if (fvp->v_type == VDIR) { + error = EINVAL; + goto abortit; + } + + /* + * Release destination. + */ + VOP_ABORTOP(tdvp, tcnp); + vput(tdvp); + vput(tvp); + + /* + * Delete source. Pretty bizarre stuff. + */ + vrele(fdvp); + vrele(fvp); + fcnp->cn_flags &= ~MODMASK; + fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; + fcnp->cn_nameiop = DELETE; + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); + if (error == 0) + vrele(fdvp); + return VOP_REMOVE(fdvp, fvp, fcnp); + } + + if (fvp is immutable) { + error = EPERM; + goto abortit; + } + + error = VOP_LOCK(fvp); + if (error) + goto abortit; + + if (vp is a directory) { + /* + * Avoid ".", "..", and aliases of "." for obvious reasons. + */ + if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') + || fdvp == fvp + || ((fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT)) { + VOP_UNLOCK(fvp); + error = EINVAL; + goto abortit; + } + doingdirectory = 1; + } + vrele(fdvp); + + /* + * Bump link count on fvp while we are moving stuff around. If we + * crash before completing the work, the link count may be wrong + * but correctable. + */ + ...; + + /* + * If ".." must be changed (ie the directory gets a new + * parent) then the source directory must not be in the + * directory heirarchy above the target, as this would + * orphan everything below the source directory. Also + * the user must have write permission in the source so + * as to be able to change "..". + */ + error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_proc); + VOP_UNLOCK(fvp); + if (doingdirectory && fdvp != tdvp) { + /* + * Check for pathname conflict. + */ + ...; + } + + /* + * If the target doesn't exist, link the target to the source and + * unlink the source. Otherwise, rewrite the target directory to + * reference the source and remove the original entry. + */ + if (tvp == NULL) { + /* + * Account for ".." in new directory. + */ + if (doingdirectory && fdvp != tdvp) { + /* + * Increase link count of tdvp. + */ + ...; + } + + /* + * Add name in new directory. + */ + ...; + + if (error) { + if (doingdirectory && fdvp != tdvp) { + /* + * Decrease link count if tdvp. + */ + ...; + } + goto bad; + } + vput(tdvp); + } else { + /* + * Target must be empty if a directory and have no links + * to it. Also, ensure source and target are compatible + * (both directories, or both not directories). + */ + if (tvp is a directory) { + if (tvp is not empty) { + error = ENOTEMPTY; + goto bad; + } + if (!doingdirectory) { + error = ENOTDIR; + goto bad; + } + /* + * Update name cache since directory is going away. + */ + cache_purge(tdvp); + } else if (doingdirectory) { + error = ENOTDIR; + goto bad; + } + + /* + * Change name tcnp in tdvp to point at fvp. + */ + ...; + + /* + * If the target directory is in same directory as the source + * directory, decrement the link count on the parent of the + * target directory. This accounts for the fact that a + * directory links back to its parent with "..". + */ + if (doingdirectory && fdvp == tdvp) { + /* + * Decrement link count of tdvp. + */ + ...; + } + vput(tdvp); + + /* + * Decrement the link count of tvp since the directory no + * longer points at it. + */ + ...; + if (doingdirectory) { + /* + * Clean up the old directory tvp. + */ + ...; + } + vput(tvp); + } + + /* + * Unlink the source. If a directory was moved to a new parent, + * update its ".." entry. Gobs of ugly UFS code omitted here. + */ + ...; + +bad: + if (tvp) + vput(tvp); + vput(tdvp); +out: + if (VOP_LOCK(fvp) == 0) { + /* + * Decrement link count of fvp. + */ + ...; + vput(fvp); + } else + vrele(fvp); + + return error; +} +.Ed +.Sh ERRORS +.Bl -tag -width ENOTEMPTY +.It Bq Er EPERM +the file is immutable +.It Bq Er EXDEV +cross device move +.It Bq Er EINVAL +illegal directory rename +.It Bq Er ENOTDIR +attempt to rename a directory to a file or vice versa +.It Bq Er ENOTEMPTY +attempt to remove a directory which is not empty +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_SEEK.9 b/share/man/man9/VOP_SEEK.9 new file mode 100644 index 000000000000..2f9e51fd2997 --- /dev/null +++ b/share/man/man9/VOP_SEEK.9 @@ -0,0 +1,72 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_SEEK +.Sh NAME +.Nm VOP_SEEK +.Nd seek to a given location in a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_SEEK "struct vnode *vp" "off_t oldoff" "off_t newoff" "struct ucred *cred" +.Sh DESCRIPTION +This seeks to a given location in a file, possibly extending the file. +Most filesystems do not implement this entry point and automatically +extend the file when it is written to. +In fact, the only place in the entire kernel where this is called is +from the union filesystem and then only to implement its own VOP_SEEK +entry point. +.Pp +Its arguments are: +.Bl -tag -width 8X +.It Ar vp +the vnode of the file +.It Ar oldoff +an offset +.It Ar newoff +another offset +.It Ar cred +the caller's credentials +.El +.Sh PSEUDOCODE +.Bd -literal +int +vop_seek(struct vnode *vp, off_t oldoff, off_t newoff, struct ucred *cred) +{ + return 0; +} +.Ed +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_SELECT.9 b/share/man/man9/VOP_SELECT.9 new file mode 100644 index 000000000000..a50e718a460b --- /dev/null +++ b/share/man/man9/VOP_SELECT.9 @@ -0,0 +1,77 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_SELECT 9 +.Sh NAME +.Nm VOP_SELECT +.Nd wait for I/O to be possible +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_SELECT "struct vnode *vp" "int which" "int fflags" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +Wait until I/O is possible on a file. +.Pp +Its arguments are: +.Bl -tag -width fflags +.It Ar vp +the vnode of the file +.It Ar which +the type of I/O to wait for +.It Ar fflags +some flags ??? +.It Ar cred +the caller's credentials +.It Ar p +the calling process +.El +.Sh PSEUDOCODE +.Bd -literal +int +vop_select(struct vnode *vp, int which, int fflags, + struct ucred *cred, struct proc *p) +{ + return 1; +} +.Ed +.Sh ERRORS +.Bl -tag -width EDQUOT +.It Bq Er ENOSPC +The filesystem is full. +.It Bq Er EDQUOT +Quota exceeded. +.El +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_STRATEGY.9 b/share/man/man9/VOP_STRATEGY.9 new file mode 100644 index 000000000000..1ce3dac31321 --- /dev/null +++ b/share/man/man9/VOP_STRATEGY.9 @@ -0,0 +1,59 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_STRATEGY 9 +.Sh NAME +.Nm VOP_STRATEGY +.Nd read or write a filesystem buffer +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Fd #include <sys/buf.h> +.Ft int +.Fn VOP_STRATEGY "struct buf *bp" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width bp +.It Ar bp +the buffer to be read or written +.El +.Pp +This call either reads or writes data from a file, depending on the value of +.Fa bp->b_flags . +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr buf 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_TRUNCATE.9 b/share/man/man9/VOP_TRUNCATE.9 new file mode 100644 index 000000000000..db6b8e5914ae --- /dev/null +++ b/share/man/man9/VOP_TRUNCATE.9 @@ -0,0 +1,77 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_TRUNCATE 9 +.Sh NAME +.Nm VOP_TRUNCATE +.Nd truncate a file +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_TRUNCATE "struct vnode *vp" "off_t length" "int flags" "struct ucred *cred" "struct proc *p" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width length +.It Ar vp +The file to truncate. +.It Ar length +The desired new length of the file. +.It Ar flags +Flags controlling I/O. +.It Ar cred +Credentials of the caller. +.It Ar p +Current process. +.El +.Pp +The size of file +.Fa vp +is set to +.Fa length . +The file can be both truncated and extended by this call. +If +.Fa flags +contains the value +.Dv IO_SYNC +then all writes to the filesystem should complete before the call returns. +This call is used internally by the UFS filesystem as part of its +implementation of +.Xr VOP_SETATTR 9 . +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_SETATTR 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_UPDATE.9 b/share/man/man9/VOP_UPDATE.9 new file mode 100644 index 000000000000..b2e6fa26946a --- /dev/null +++ b/share/man/man9/VOP_UPDATE.9 @@ -0,0 +1,65 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_UPDATE 9 +.Sh NAME +.Nm VOP_UPDATE +.Nd update the on-disc version of a vnode +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_UPDATE "struct vnode *vp" "struct timeval *access" "struct timeval *modify" "int waitfor" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width waitfor +.It Ar vp +The file to update. +.It Ar access +The new accessed time for the file. +.It Ar modify +The new modified time for the file. +.It Ar waitfor +Wait for I/O to complete if true. +.El +.Pp +The accessed and modified of the file are set and the on-disc version +of the vnode is updated. +This call is used internally by the UFS filesystem. +.Sh RETURN VALUES +Zero is returned on success, otherwise an error is returned. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VOP_SETATTR 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/VOP_VALLOC.9 b/share/man/man9/VOP_VALLOC.9 new file mode 100644 index 000000000000..f9feaa9e59e3 --- /dev/null +++ b/share/man/man9/VOP_VALLOC.9 @@ -0,0 +1,63 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VOP_VALLOC 9 +.Sh NAME +.Nm VOP_VALLOC , +.Nm VOP_VFREE +.Nd Allocate a new inode in the filesystem. +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn VOP_VALLOC "struct vnode *pvp" "int mode" "struct ucred *cred" "struct vnode **vpp" +.Ft int +.Fn VOP_VFREE "struct vnode *pvp" "ino_t ino" "int mode" +.Sh DESCRIPTION +.Pp +The arguments are: +.Bl -tag -width mdoe +.It Ar pvp +The parent directory of the new vnode. +.It Ar mode +The mode and type of the new vnode. +.It Ar cred +The credentials of the caller. +.It Ar vpp +Return parameter for the new vnode. +.El +.Pp +These calls are used internally by the UFS filesystem to allocate and +free filesystem resources. +.Sh SEE ALSO +.Xr vnode 9 +.Sh AUTHORS +This man page was written by Doug Rabson. diff --git a/share/man/man9/VOP_VPTOFH.9 b/share/man/man9/VOP_VPTOFH.9 new file mode 100644 index 000000000000..a3ad2ea08fb3 --- /dev/null +++ b/share/man/man9/VOP_VPTOFH.9 @@ -0,0 +1,60 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt VFS_VPTOFH 9 +.Sh NAME +.Nm VFS_VPTOFH +.Nd turn a vnode into an NFS filehandle +.Sh SYNOPSIS +.Fd #include <sys/mount.h> +.Fd #include <sys/vnode.h> +.Ft int +.Fn VFS_VPTOFH "struct vnode *vp" "struct fid *fhp" +.Sh DESCRIPTION +This is used by the NFS server to create an opaque filehandle which +uniquely identifies the file and which can be used by an NFS client +to access the file in the future. +.Pp +Its arguments are: +.Bl -tag -width fhp +.It Ar vp +The vnode to make a filehandle for. +.It Ar fhp +Return parameter for the filehandle. +.El +.Sh SEE ALSO +.Xr vnode 9 , +.Xr VFS 9 , +.Xr VFS_FHTOVP +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/vget.9 b/share/man/man9/vget.9 new file mode 100644 index 000000000000..749eb98ec79c --- /dev/null +++ b/share/man/man9/vget.9 @@ -0,0 +1,68 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt vget 9 +.Sh NAME +.Nm vget +.Nd get a vnode from the free list +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn vget "struct vnode *vp" "int lockflag" +.Sh DESCRIPTION +Get a vnode from the free list and increment its reference count. +.Bl -tag -width lockflag +.It Ar vp +the vnode to remove from the free list +.It Ar lockflag +if non-zero, the vnode will also be locked +.El +.Pp +When not in use, vnodes are kept on a free list. The vnodes still +reference valid files but may be reused to refer to a new file at any +time. Often, these vnodes are also held in caches in the system, such +as the name cache. +.Pp +When a vnode which is on the free list is used again, for instance if +the vnode was found in the name cache as a result of a call to +.Xr VOP_LOOKUP 9 +then the new user must call +.Xr vget 9 +to increment the reference count and remove it from the free list. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr vput 9 , +.Xr vref 9 , +.Xr vrele 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/vnode.9 b/share/man/man9/vnode.9 new file mode 100644 index 000000000000..4ab29e63dd7d --- /dev/null +++ b/share/man/man9/vnode.9 @@ -0,0 +1,178 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt vnode 9 +.Sh NAME +.Nm vnode +.Nd internal representation of a file or directory +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Pp +.Bd -literal +/* + * Vnode types. VNON means no type. + */ +enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; + +/* + * Vnode tag types. + * These are for the benefit of external programs only (e.g., pstat) + * and should NEVER be inspected by the kernel. + */ +enum vtagtype { + VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, + VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, + VT_UNION, VT_MSDOSFS, VT_DEVFS +}; + +/* + * Each underlying filesystem allocates its own private area and hangs + * it from v_data. If non-null, this area is freed in getnewvnode(). + */ +LIST_HEAD(buflists, buf); + +typedef int vop_t __P((void *)); + +struct vnode { + u_long v_flag; /* vnode flags (see below) */ + int v_usecount; /* reference count of users */ + int v_writecount; /* reference count of writers */ + int v_holdcnt; /* page & buffer references */ + daddr_t v_lastr; /* last read (read-ahead) */ + u_long v_id; /* capability identifier */ + struct mount *v_mount; /* ptr to vfs we are in */ + vop_t **v_op; /* vnode operations vector */ + TAILQ_ENTRY(vnode) v_freelist; /* vnode freelist */ + LIST_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */ + struct buflists v_cleanblkhd; /* clean blocklist head */ + struct buflists v_dirtyblkhd; /* dirty blocklist head */ + long v_numoutput; /* num of writes in progress */ + enum vtype v_type; /* vnode type */ + union { + struct mount *vu_mountedhere;/* ptr to mounted vfs (VDIR) */ + struct socket *vu_socket; /* unix ipc (VSOCK) */ + struct specinfo *vu_specinfo; /* device (VCHR, VBLK) */ + struct fifoinfo *vu_fifoinfo; /* fifo (VFIFO) */ + } v_un; + struct nqlease *v_lease; /* Soft reference to lease */ + daddr_t v_lastw; /* last write (write cluster) */ + daddr_t v_cstart; /* start block of cluster */ + daddr_t v_lasta; /* last allocation */ + int v_clen; /* length of current cluster */ + int v_ralen; /* Read-ahead length */ + int v_usage; /* Vnode usage counter */ + daddr_t v_maxra; /* last readahead block */ + void *v_object; /* Place to store VM object */ + enum vtagtype v_tag; /* type of underlying data */ + void *v_data; /* private data for fs */ +}; +#define v_mountedhere v_un.vu_mountedhere +#define v_socket v_un.vu_socket +#define v_specinfo v_un.vu_specinfo +#define v_fifoinfo v_un.vu_fifoinfo + +/* + * Vnode flags. + */ +#define VROOT 0x0001 /* root of its file system */ +#define VTEXT 0x0002 /* vnode is a pure text prototype */ +#define VSYSTEM 0x0004 /* vnode being used by kernel */ +#define VOLOCK 0x0008 /* vnode is locked waiting for an object */ +#define VOWANT 0x0010 /* a process is waiting for VOLOCK */ +#define VXLOCK 0x0100 /* vnode is locked to change underlying type */ +#define VXWANT 0x0200 /* process is waiting for vnode */ +#define VBWAIT 0x0400 /* waiting for output to complete */ +#define VALIASED 0x0800 /* vnode has an alias */ +#define VDIROP 0x1000 /* LFS: vnode is involved in a directory op */ +#define VVMIO 0x2000 /* VMIO flag */ +#define VNINACT 0x4000 /* LFS: skip ufs_inactive() in lfs_vunref */ +#define VAGE 0x8000 /* Insert vnode at head of free list */ +.Ed +.Sh DESCRIPTION +The vnode is the focus of all file activity in UNIX. There is a +unique vnode allocated for each active file, each current directory, +each mounted-on file, text file, and the root. +.Pp +Each vnode has two reference counts, +.Dv v_usecount +and +.Dv v_writecount . +The first is the number of clients within the kernel which are +using this vnode. This count is maintained by +.Xr vref 9 , +.Xr vrele 9 and +.Xr vput 9 . +When the +.Dv v_usecount +of a vnode reaches zero then the vnode may be reused for another +file, possibly in another filesystem. +The second is a count of the number of clients which are writing into +the file. It is maintained by the +.Xr open 2 +and +.Xr close 2 +system calls. +.Pp +Any call which returns a vnode (e.g. +.Xr VFS_GET 9 , +.Xr VOP_LOOKUP 9 +etc.) +will increase the +.Dv v_usecount +of the vnode by one. When the caller is finished with the vnode, it +should release this reference by calling +.Xr vrele 9 +(or +.Xr vput 9 +if the vnode is locked). +.Pp +Other commonly used members of the vnode structure are +.Dv v_id +which is used to maintain consistency in the name cache, +.Dv v_mount +which points at the filesystem which owns the vnode, +.Dv v_type +which contains the type of object the vnode represents and +.Dv v_data +which is used by filesystems to store filesystem specific data with +the vnode. +The +.Dv v_op +field is used by the +.Dv VOP_* +macros to call functions in the filesystem which implement the vnode's +functionality. +.Sh SEE ALSO +.Xr VFS 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/vput.9 b/share/man/man9/vput.9 new file mode 100644 index 000000000000..cf2cba191b5f --- /dev/null +++ b/share/man/man9/vput.9 @@ -0,0 +1,61 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt vput 9 +.Sh NAME +.Nm vput +.Nd decrement the use count for a vnode and unlock it +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn vput "struct vnode *vp" +.Sh DESCRIPTION +Decrement the +.Dv v_usecount +field of a vnode and unlock the vnode. +.Bl -tag -width vp +.It Ar vp +the vnode to decrement +.El +.Pp +This operation is functionally equivalent to calling +.Xr VOP_UNLOCK 9 +followed by +.Xr vrele 9 . +.Sh SEE ALSO +.Xr vnode 9 , +.Xr vref 9 , +.Xr vrele 9 , +.Xr VOP_UNLOCK 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/vref.9 b/share/man/man9/vref.9 new file mode 100644 index 000000000000..47282da4b506 --- /dev/null +++ b/share/man/man9/vref.9 @@ -0,0 +1,65 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt vref 9 +.Sh NAME +.Nm vref +.Nd increment the use count for a vnode +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn vref "struct vnode *vp" +.Sh DESCRIPTION +Increment the +.Dv v_usecount +field of a vnode. +.Bl -tag -width vp +.It Ar vp +the vnode to increment +.El +.Pp +Each vnode maintains a reference count of how many parts of the system +are using the vnode. This allows the system to detect when a vnode is +no longer being used and can be safely recycled for a different file. +.Pp +Any code in the system which is using a vnode (e.g. during the +operation of some algorithm or to store in a data structure) should +call +.Xr vref 9 . +.Sh SEE ALSO +.Xr vnode 9 , +.Xr vget 9 , +.Xr vput 9 , +.Xr vrele 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + diff --git a/share/man/man9/vrele.9 b/share/man/man9/vrele.9 new file mode 100644 index 000000000000..ed748d790dbf --- /dev/null +++ b/share/man/man9/vrele.9 @@ -0,0 +1,63 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 1996 Doug Rabson +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS 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. +.\" +.\" $Id$ +.\" +.Dd July 24, 1996 +.Os +.Dt vrele 9 +.Sh NAME +.Nm vrele +.Nd decrement the use count for a vnode +.Sh SYNOPSIS +.Fd #include <sys/vnode.h> +.Ft int +.Fn vrele "struct vnode *vp" +.Sh DESCRIPTION +Decrement the +.Dv v_usecount +field of a vnode. +.Bl -tag -width vp +.It Ar vp +the vnode to decrement +.El +.Pp +Any code in the system which is using a vnode should call +.Xr vrele 9 +when it is finished with the vnode. +If the +.Dv v_usecount +field of the vnode reaches zero, then it will be placed on the free list. +.Sh SEE ALSO +.Xr vnode 9 , +.Xr vget 9 , +.Xr vput 9 , +.Xr vref 9 +.Sh AUTHORS +This man page was written by Doug Rabson. + |