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. 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. 53 * 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 64 * SUCH DAMAGE. 65 */ 66 /* 67 * This module serves as a focal point for virtually all filesystem and 68 * device related calls. It is or will be responsible for all high level 69 * kernel management for filesystem and device operations, including but 70 * limited to: 71 * 72 * Function Status 73 * ---------------- ----- 74 * Journaling TODO 75 * Range Locking TODO 76 * Cache Coherency TODO 77 * VNode Operations Dispatch TODO 78 * Mount Point Operations TODO 79 * FileOps Operations TODO 80 */ 81 82 #ifndef _SYS_VFSCACHE_H_ 83 #define _SYS_VFSCACHE_H_ 84 85 #ifndef _SYS_TYPES_H_ 86 #include <sys/types.h> 87 #endif 88 #ifndef _SYS_TIME_H_ 89 #include <sys/time.h> 90 #endif 91 #ifndef _SYS_VFSOPS_H_ 92 #include <sys/vfsops.h> 93 #endif 94 #ifndef _SYS_UUID_H_ 95 #include <sys/uuid.h> 96 #endif 97 98 /* 99 * Vnode types. VNON means no type or transitory type. VINT is used 100 * for internal types. Note that VNON is skipped by the vnode scan. 101 */ 102 enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, 103 VDATABASE, VINT }; 104 105 /* 106 * Vnode tag types. 107 * These are for the benefit of external programs only (e.g., pstat) 108 * and should NEVER be inspected by the kernel. 109 */ 110 enum vtagtype { 111 VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_UNUSED7, 112 VT_PORTAL, VT_NULL, VT_UNUSED10, VT_KERNFS, VT_PROCFS, VT_AFS, 113 VT_ISOFS, VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, 114 VT_HPFS, VT_SMBFS, VT_UDF, VT_EXT2FS, VT_SYNTH, 115 VT_HAMMER, VT_HAMMER2, VT_DEVFS, VT_TMPFS 116 }; 117 118 /* 119 * Vnode attributes. A field value of VNOVAL represents a field whose value 120 * is unavailable (getattr) or which is not to be changed (setattr). 121 * 122 * Some vattr fields may be wider then what is reported to userland. 123 */ 124 struct vattr { 125 enum vtype va_type; /* vnode type (for create) */ 126 u_int64_t va_nlink; /* number of references to file */ 127 u_short va_mode; /* files access mode and type */ 128 uid_t va_uid; /* owner user id */ 129 gid_t va_gid; /* owner group id */ 130 udev_t va_fsid; /* file system id */ 131 ino_t va_fileid; /* file id */ 132 u_quad_t va_size; /* file size in bytes */ 133 long va_blocksize; /* blocksize preferred for i/o */ 134 struct timespec va_atime; /* time of last access */ 135 struct timespec va_mtime; /* time of last modification */ 136 struct timespec va_ctime; /* time file changed */ 137 u_int64_t va_gen; /* generation number of file */ 138 u_long va_flags; /* flags defined for file */ 139 int va_rmajor; /* device the special file represents */ 140 int va_rminor; 141 u_quad_t va_bytes; /* bytes of disk space held by file */ 142 u_quad_t va_filerev; /* file modification number */ 143 u_int va_vaflags; /* operations flags, see below */ 144 long va_spare; /* remain quad aligned */ 145 int64_t va_unused01; 146 uuid_t va_uid_uuid; /* native uuids if available */ 147 uuid_t va_gid_uuid; 148 uuid_t va_fsid_uuid; 149 }; 150 151 /* 152 * Flags for va_vaflags. 153 * 154 * NOTE: The short versions for the uid, gid, and fsid are always populated 155 * even when the uuid versions are available. 156 */ 157 #define VA_UTIMES_NULL 0x0001 /* utimes argument was NULL */ 158 #define VA_EXCLUSIVE 0x0002 /* exclusive create request */ 159 #define VA_UID_UUID_VALID 0x0004 /* uuid fields also populated */ 160 #define VA_GID_UUID_VALID 0x0008 /* uuid fields also populated */ 161 #define VA_FSID_UUID_VALID 0x0010 /* uuid fields also populated */ 162 163 #endif 164 165