xref: /netbsd/share/man/man9/vattr.9 (revision c4a72b64)
1.\"     $NetBSD: vattr.9,v 1.4 2002/10/14 13:43:35 wiz 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 October 21, 2001
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.Fd #include \*[Lt]sys/param.h\*[Gt]
47.Fd #include \*[Lt]sys/vnode.h\*[Gt]
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 modication 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        u_long          va_gen;         /* generation number of file */
73        u_long          va_flags;       /* flags defined for file */
74        dev_t           va_rdev;        /* device the special file represents */
75        u_quad_t        va_bytes;       /* bytes of disk space held by file */
76        u_quad_t        va_filerev;     /* file modification number */
77        u_int           va_vaflags;     /* operations flags, see below */
78        long            va_spare;       /* remain quad aligned */
79};
80.Ed
81.Pp
82A field value of VNOVAL represents a field whose value is unavailable
83or which is not to be changed.
84Valid flag values for
85.Em va_flags
86are:
87.Pp
88.Bl -tag -offset indent -width VA_UTIMES_NULL -compact
89.It VA_UTIMES_NULL
90utimes argument was NULL
91.It VA_EXCLUSIVE
92exclusive create request
93.El
94.Pp
95Vnode attributes for a file are set by the vnode operation
96.Xr VOP_SETATTR 9 .
97Vnode attributes for a file are retrieved by the vnode operation
98.Xr VOP_GETATTR 9 .
99For more information on vnode operations see
100.Xr vnodeops 9 .
101.Sh FUNCTIONS
102.Bl -tag -width compact
103.It Fn vattr_null "vap"
104Set vnode attributes in
105.Fa vap
106to VNOVAL.
107.It Fn VATTR_NULL "vap"
108This function is an alias for
109.Fn vattr_null .
110.El
111.Sh CODE REFERENCES
112This section describes places within the
113.Nx
114source tree where actual code implementing or utilising the vnode
115attributes can be found.
116All pathnames are relative to
117.Pa /usr/src .
118.Pp
119The vnode attributes ares implemented within the file
120.Pa sys/kern/vfs_subr.c .
121.Sh SEE ALSO
122.Xr intro 9 ,
123.Xr vfs 9 ,
124.Xr vnode 9 ,
125.Xr vnodeops 9
126