xref: /netbsd-src/share/man/man9/vattr.9 (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1.\"     $NetBSD: vattr.9,v 1.8 2007/06/24 22:49:44 rumble Exp $
2.\"
3.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Gregory McGarry.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd June 24, 2007
38.Dt VATTR 9
39.Os
40.Sh NAME
41.Nm vattr ,
42.Nm vattr_null ,
43.Nm VATTR_NULL
44.Nd vnode attributes
45.Sh SYNOPSIS
46.In sys/param.h
47.In sys/vnode.h
48.Ft void
49.Fn vattr_null "struct vattr *vap"
50.Ft void
51.Fn VATTR_NULL "struct vattr *vap"
52.Sh DESCRIPTION
53Vnode attributes describe attributes of a file or directory including
54file permissions, owner, group, size, access time and modification time.
55.Pp
56A vnode attribute has the following structure:
57.Pp
58.Bd -literal
59struct vattr {
60        enum vtype      va_type;        /* vnode type (for create) */
61        mode_t          va_mode;        /* files access mode and type */
62        nlink_t         va_nlink;       /* number of references to file */
63        uid_t           va_uid;         /* owner user id */
64        gid_t           va_gid;         /* owner group id */
65        long            va_fsid;        /* file system id (dev for now) */
66        long            va_fileid;      /* file id */
67        u_quad_t        va_size;        /* file size in bytes */
68        long            va_blocksize;   /* blocksize preferred for i/o */
69        struct timespec va_atime;       /* time of last access */
70        struct timespec va_mtime;       /* time of last modification */
71        struct timespec va_ctime;       /* time file changed */
72        struct timespec va_birthtime;   /* time file created */
73        u_long          va_gen;         /* generation number of file */
74        u_long          va_flags;       /* flags defined for file */
75        dev_t           va_rdev;        /* device the special file represents */
76        u_quad_t        va_bytes;       /* bytes of disk space held by file */
77        u_quad_t        va_filerev;     /* file modification number */
78        u_int           va_vaflags;     /* operations flags, see below */
79        long            va_spare;       /* remain quad aligned */
80};
81.Ed
82.Pp
83A field value of VNOVAL represents a field whose value is unavailable
84or which is not to be changed.
85Valid flag values for
86.Em va_flags
87are:
88.Pp
89.Bl -tag -offset indent -width VA_UTIMES_NULL -compact
90.It VA_UTIMES_NULL
91utimes argument was NULL
92.It VA_EXCLUSIVE
93exclusive create request
94.El
95.Pp
96Vnode attributes for a file are set by the vnode operation
97.Xr VOP_SETATTR 9 .
98Vnode attributes for a file are retrieved by the vnode operation
99.Xr VOP_GETATTR 9 .
100For more information on vnode operations see
101.Xr vnodeops 9 .
102.Sh FUNCTIONS
103.Bl -tag -width compact
104.It Fn vattr_null "vap"
105Set vnode attributes in
106.Fa vap
107to VNOVAL.
108.It Fn VATTR_NULL "vap"
109This function is an alias for
110.Fn vattr_null .
111.El
112.Sh CODE REFERENCES
113This section describes places within the
114.Nx
115source tree where actual code implementing or using the vnode
116attributes can be found.
117All pathnames are relative to
118.Pa /usr/src .
119.Pp
120The vnode attributes ares implemented within the file
121.Pa sys/kern/vfs_subr.c .
122.Sh SEE ALSO
123.Xr intro 9 ,
124.Xr vfs 9 ,
125.Xr vnode 9 ,
126.Xr vnodeops 9
127