NetBSD/share/man/man9/vattr.9

124 lines
4.8 KiB
Groff

.\" $NetBSD: vattr.9,v 1.2 2001/10/22 08:21:33 wiz Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Gregory McGarry.
.\"
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 21, 2001
.Dt VATTR 9
.Os
.Sh NAME
.Nm vattr ,
.Nm vattr_null ,
.Nm VATTR_NULL
.Nd vnode attributes
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Fd #include <sys/vnode.h>
.Ft void
.Fn vattr_null "struct vattr *vap"
.Ft void
.Fn VATTR_NULL "struct vattr *vap"
.Sh DESCRIPTION
Vnode attributes describe attributes of a file or directory including
file permissions, owner, group, size, access time and modication time.
.Pp
A vnode attribute has the following structure:
.Pp
.Bd -literal
struct vattr {
enum vtype va_type; /* vnode type (for create) */
mode_t va_mode; /* files access mode and type */
nlink_t va_nlink; /* number of references to file */
uid_t va_uid; /* owner user id */
gid_t va_gid; /* owner group id */
long va_fsid; /* file system id (dev for now) */
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
u_long va_gen; /* generation number of file */
u_long va_flags; /* flags defined for file */
dev_t va_rdev; /* device the special file represents */
u_quad_t va_bytes; /* bytes of disk space held by file */
u_quad_t va_filerev; /* file modification number */
u_int va_vaflags; /* operations flags, see below */
long va_spare; /* remain quad aligned */
};
.Ed
.Pp
A field value of VNOVAL represents a field whose value is unavailable
or which is not to be changed. Valid flag values for
.Em va_flags
are:
.Pp
.Bl -tag -offset indent -width VA_UTIMES_NULL -compact
.It VA_UTIMES_NULL
utimes argument was NULL
.It VA_EXCLUSIVE
exclusive create request
.El
.Pp
Vnode attributes for a file are set by the vnode operation
.Xr VOP_SETATTR 9 .
Vnode attributes for a file are retrieved by the vnode operation
.Xr VOP_GETATTR 9 .
For more information on vnode operations see
.Xr vnodeops 9 .
.Sh FUNCTIONS
.Bl -tag -width compact
.It Fn vattr_null "vap"
Set vnode attributes in
.Fa vap
to VNOVAL.
.It Fn VATTR_NULL "vap"
This function is an alias for
.Fn vattr_null .
.El
.Sh CODE REFERENCES
This section describes places within the
.Nx
source tree where actual code implementing or utilising the vnode
attributes can be found. All pathnames are relative to
.Pa /usr/src .
.Pp
The vnode attributes ares implemented within the file
.Pa sys/kern/vfs_subr.c .
.Sh SEE ALSO
.Xr intro 9 ,
.Xr vfs 9 ,
.Xr vnode 9 ,
.Xr vnodeops 9