2 * Copyright (c) 2004 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * Copyright (c) 1989, 1993
36 * The Regents of the University of California. All rights reserved.
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed by the University of
49 * California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 * may be used to endorse or promote products derived from this software
52 * without specific prior written permission.
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66 * $DragonFly: src/sys/sys/vfscache.h,v 1.12 2007/11/02 19:52:24 dillon Exp $
69 * This module serves as a focal point for virtually all filesystem and
70 * device related calls. It is or will be responsible for all high level
71 * kernel management for filesystem and device operations, including but
75 * ---------------- -----
78 * Cache Coherency TODO
79 * VNode Operations Dispatch TODO
80 * Mount Point Operations TODO
81 * FileOps Operations TODO
84 #ifndef _SYS_VFSCACHE_H_
85 #define _SYS_VFSCACHE_H_
88 #include <sys/types.h>
93 #ifndef _SYS_VFSOPS_H_
94 #include <sys/vfsops.h>
101 * Vnode types. VNON means no type.
103 enum vtype
{ VNON
, VREG
, VDIR
, VBLK
, VCHR
, VLNK
, VSOCK
, VFIFO
, VBAD
,
108 * These are for the benefit of external programs only (e.g., pstat)
109 * and should NEVER be inspected by the kernel.
112 VT_NON
, VT_UFS
, VT_NFS
, VT_MFS
, VT_PC
, VT_LFS
, VT_LOFS
, VT_FDESC
,
113 VT_PORTAL
, VT_NULL
, VT_UNUSED10
, VT_KERNFS
, VT_PROCFS
, VT_AFS
,
114 VT_ISOFS
, VT_UNION
, VT_MSDOSFS
, VT_TFS
, VT_VFS
, VT_CODA
, VT_NTFS
,
115 VT_HPFS
, VT_NWFS
, VT_SMBFS
, VT_UDF
, VT_EXT2FS
, VT_SYNTH
,
116 VT_USERFS
, VT_HAMMER
, VT_DEVFS
120 * Vnode attributes. A field value of VNOVAL represents a field whose value
121 * is unavailable (getattr) or which is not to be changed (setattr).
123 * Some vattr fields may be wider then what is reported to userland.
126 enum vtype va_type
; /* vnode type (for create) */
127 u_int64_t va_nlink
; /* number of references to file */
128 u_short va_mode
; /* files access mode and type */
129 uid_t va_uid
; /* owner user id */
130 gid_t va_gid
; /* owner group id */
131 udev_t va_fsid
; /* file system id */
132 ino_t va_fileid
; /* file id */
133 u_quad_t va_size
; /* file size in bytes */
134 long va_blocksize
; /* blocksize preferred for i/o */
135 struct timespec va_atime
; /* time of last access */
136 struct timespec va_mtime
; /* time of last modification */
137 struct timespec va_ctime
; /* time file changed */
138 u_int64_t va_gen
; /* generation number of file */
139 u_long va_flags
; /* flags defined for file */
140 int va_rmajor
; /* device the special file represents */
142 u_quad_t va_bytes
; /* bytes of disk space held by file */
143 u_quad_t va_filerev
; /* file modification number */
144 u_int va_vaflags
; /* operations flags, see below */
145 long va_spare
; /* remain quad aligned */
146 int64_t va_fsmid
; /* filesystem modification id */
147 uuid_t va_uid_uuid
; /* native uuids if available */
153 * Flags for va_vaflags.
155 * NOTE: The short versions for the uid, gid, and fsid are always populated
156 * even when the uuid versions are available.
158 #define VA_UTIMES_NULL 0x0001 /* utimes argument was NULL */
159 #define VA_EXCLUSIVE 0x0002 /* exclusive create request */
160 #define VA_UID_UUID_VALID 0x0004 /* uuid fields also populated */
161 #define VA_GID_UUID_VALID 0x0008 /* uuid fields also populated */
162 #define VA_FSID_UUID_VALID 0x0010 /* uuid fields also populated */
167 * The vfscache structure holds the system cacheable elements associated with
168 * a file or device. This structure is most typically embedded within a
173 struct vm_object
*fc_object
; /* cached data */
174 struct vattr fc_attr
; /* cached attribute data */
177 #define FCF_ATTR_GOOD 0x00000001 /* FUTURE */
178 #define FCF_ATTR_ATIME 0x00010000 /* FUTURE attr modifications */
179 #define FCF_ATTR_MTIME 0x00020000 /* FUTURE attr modifications */
180 #define FCF_ATTR_CTIME 0x00040000 /* FUTURE attr modifications */
181 #define FCF_ATTR_UID 0x00080000 /* FUTURE attr modifications */
182 #define FCF_ATTR_GID 0x00100000 /* FUTURE attr modifications */
183 #define FCF_ATTR_SIZE 0x00200000 /* FUTURE attr modifications */