1 /* 2 * Copyright (c) 2004 The DragonFly Project. All rights reserved. 3 * 4 * This code is derived from software contributed to The DragonFly Project 5 * by Matthew Dillon <dillon@backplane.com> 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 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 16 * distribution. 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. 20 * 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 32 * SUCH DAMAGE. 33 * 34 * 35 * Copyright (c) 1989, 1993 36 * The Regents of the University of California. All rights reserved. 37 * 38 * Redistribution and use in source and binary forms, with or without 39 * modification, are permitted provided that the following conditions 40 * are met: 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. Neither the name of the University nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * SUCH DAMAGE. 61 */ 62 /* 63 * This module serves as a focal point for virtually all filesystem and 64 * device related calls. It is or will be responsible for all high level 65 * kernel management for filesystem and device operations, including but 66 * limited to: 67 * 68 * Function Status 69 * ---------------- ----- 70 * Journaling TODO 71 * Range Locking TODO 72 * Cache Coherency TODO 73 * VNode Operations Dispatch TODO 74 * Mount Point Operations TODO 75 * FileOps Operations TODO 76 */ 77 78 #ifndef _SYS_VFSCACHE_H_ 79 #define _SYS_VFSCACHE_H_ 80 81 #ifndef _SYS_TYPES_H_ 82 #include <sys/types.h> 83 #endif 84 #ifndef _SYS_TIME_H_ 85 #include <sys/time.h> 86 #endif 87 #ifndef _SYS_VFSOPS_H_ 88 #include <sys/vfsops.h> 89 #endif 90 #ifndef _SYS_UUID_H_ 91 #include <sys/uuid.h> 92 #endif 93 94 /* 95 * Vnode types. VNON means no type or transitory type. VINT is used 96 * for internal types. Note that VNON is skipped by the vnode scan. 97 */ 98 enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, 99 VDATABASE, VINT }; 100 101 /* 102 * Vnode tag types. 103 * These are for the benefit of external programs only (e.g., pstat) 104 * and should NEVER be inspected by the kernel. 105 */ 106 enum vtagtype { 107 VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_UNUSED4, VT_UNUSED5, VT_UNUSED6, 108 VT_UNUSED7, VT_UNUSED8, VT_NULL, VT_UNUSED10, VT_UNUSED11, VT_PROCFS, 109 VT_UNUSED13, VT_ISOFS, VT_UNUSED15, VT_MSDOSFS, VT_UNUSED17, VT_VFS, 110 VT_UNUSED19, VT_NTFS, VT_HPFS, VT_SMBFS, VT_UDF, VT_EXT2FS, VT_SYNTH, 111 VT_HAMMER, VT_HAMMER2, VT_DEVFS, VT_TMPFS, VT_AUTOFS, VT_FUSE 112 }; 113 114 /* 115 * Vnode attributes. A field value of VNOVAL represents a field whose value 116 * is unavailable (getattr) or which is not to be changed (setattr). 117 * 118 * Some vattr fields may be wider then what is reported to userland. 119 */ 120 struct vattr { 121 enum vtype va_type; /* vnode type (for create) */ 122 u_int64_t va_nlink; /* number of references to file */ 123 u_short va_mode; /* files access mode and type */ 124 uid_t va_uid; /* owner user id */ 125 gid_t va_gid; /* owner group id */ 126 dev_t va_fsid; /* file system id */ 127 ino_t va_fileid; /* file id */ 128 u_quad_t va_size; /* file size in bytes */ 129 long va_blocksize; /* blocksize preferred for i/o */ 130 struct timespec va_atime; /* time of last access */ 131 struct timespec va_mtime; /* time of last modification */ 132 struct timespec va_ctime; /* time file changed */ 133 u_int64_t va_gen; /* generation number of file */ 134 u_long va_flags; /* flags defined for file */ 135 int va_rmajor; /* device the special file represents */ 136 int va_rminor; 137 u_quad_t va_bytes; /* bytes of disk space held by file */ 138 u_quad_t va_filerev; /* file modification number */ 139 u_int va_vaflags; /* operations flags, see below */ 140 long va_spare; /* remain quad aligned */ 141 uint32_t va_fuseflags; /* used by FUSE */ 142 uint32_t va_unused01; 143 uuid_t va_uid_uuid; /* native uuids if available */ 144 uuid_t va_gid_uuid; 145 uuid_t va_fsid_uuid; 146 }; 147 148 /* 149 * A light version of vattr used by the fast-path GETATTR_LITE() 150 * 151 * NOTE: If adjusting fields in this structure, also adjust in 152 * vop_stdgetattr_lite() and kern_futimes(). 153 */ 154 struct vattr_lite { 155 enum vtype va_type; /* vnode type (for create) */ 156 u_int64_t va_nlink; /* number of references to file */ 157 u_short va_mode; /* files access mode and type */ 158 uid_t va_uid; /* owner user id */ 159 gid_t va_gid; /* owner group id */ 160 u_quad_t va_size; /* file size in bytes */ 161 u_long va_flags; /* flags defined for file */ 162 }; 163 164 /* 165 * Flags for va_vaflags. 166 * 167 * NOTE: The short versions for the uid, gid, and fsid are always populated 168 * even when the uuid versions are available. 169 */ 170 #define VA_UTIMES_NULL 0x0001 /* utimes argument was NULL */ 171 #define VA_EXCLUSIVE 0x0002 /* exclusive create request */ 172 #define VA_UID_UUID_VALID 0x0004 /* uuid fields also populated */ 173 #define VA_GID_UUID_VALID 0x0008 /* uuid fields also populated */ 174 #define VA_FSID_UUID_VALID 0x0010 /* uuid fields also populated */ 175 176 #endif 177 178