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 * $DragonFly: src/sys/sys/vfscache.h,v 1.3 2005/09/17 07:43:01 dillon Exp $ 67 */ 68 /* 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 72 * limited to: 73 * 74 * Function Status 75 * ---------------- ----- 76 * Journaling TODO 77 * Range Locking TODO 78 * Cache Coherency TODO 79 * VNode Operations Dispatch TODO 80 * Mount Point Operations TODO 81 * FileOps Operations TODO 82 */ 83 84 #ifndef _SYS_VFSCACHE_H_ 85 #define _SYS_VFSCACHE_H_ 86 87 #ifndef _SYS_VFSOPS_H_ 88 #include <sys/vfsops.h> 89 #endif 90 91 /* 92 * Vnode types. VNON means no type. 93 */ 94 enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; 95 96 /* 97 * Vnode tag types. 98 * These are for the benefit of external programs only (e.g., pstat) 99 * and should NEVER be inspected by the kernel. 100 */ 101 enum vtagtype { 102 VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, 103 VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, 104 VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, 105 VT_HPFS, VT_NWFS, VT_SMBFS, VT_UDF 106 }; 107 108 /* 109 * Vnode attributes. A field value of VNOVAL represents a field whose value 110 * is unavailable (getattr) or which is not to be changed (setattr). 111 */ 112 struct vattr { 113 enum vtype va_type; /* vnode type (for create) */ 114 nlink_t va_nlink; /* number of references to file */ 115 u_short va_mode; /* files access mode and type */ 116 uid_t va_uid; /* owner user id */ 117 gid_t va_gid; /* owner group id */ 118 udev_t va_fsid; /* file system id */ 119 long va_fileid; /* file id */ 120 u_quad_t va_size; /* file size in bytes */ 121 long va_blocksize; /* blocksize preferred for i/o */ 122 struct timespec va_atime; /* time of last access */ 123 struct timespec va_mtime; /* time of last modification */ 124 struct timespec va_ctime; /* time file changed */ 125 u_long va_gen; /* generation number of file */ 126 u_long va_flags; /* flags defined for file */ 127 udev_t va_rdev; /* device the special file represents */ 128 u_quad_t va_bytes; /* bytes of disk space held by file */ 129 u_quad_t va_filerev; /* file modification number */ 130 u_int va_vaflags; /* operations flags, see below */ 131 long va_spare; /* remain quad aligned */ 132 int64_t va_fsmid; /* filesystem modification id */ 133 }; 134 135 /* 136 * Flags for va_vaflags. 137 */ 138 #define VA_UTIMES_NULL 0x01 /* utimes argument was NULL */ 139 #define VA_EXCLUSIVE 0x02 /* exclusive create request */ 140 141 #if 0 /* NOT YET */ 142 143 /* 144 * The vfscache structure holds the system cacheable elements associated with 145 * a file or device. This structure is most typically embedded within a 146 * vnode. 147 */ 148 struct vfscache { 149 int fc_flags; 150 struct vm_object *fc_object; /* cached data */ 151 struct vattr fc_attr; /* cached attribute data */ 152 }; 153 154 #define FCF_ATTR_GOOD 0x00000001 /* FUTURE */ 155 #define FCF_ATTR_ATIME 0x00010000 /* FUTURE attr modifications */ 156 #define FCF_ATTR_MTIME 0x00020000 /* FUTURE attr modifications */ 157 #define FCF_ATTR_CTIME 0x00040000 /* FUTURE attr modifications */ 158 #define FCF_ATTR_UID 0x00080000 /* FUTURE attr modifications */ 159 #define FCF_ATTR_GID 0x00100000 /* FUTURE attr modifications */ 160 #define FCF_ATTR_SIZE 0x00200000 /* FUTURE attr modifications */ 161 162 #endif 163 164 #endif 165 166