vkernel64 - Cleanup, unbreak 32 bit
[dragonfly.git] / sys / sys / vfscache.h
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.12 2007/11/02 19:52:24 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_TYPES_H_
88 #include <sys/types.h>
89 #endif
90 #ifndef _SYS_TIME_H_
91 #include <sys/time.h>
92 #endif
93 #ifndef _SYS_VFSOPS_H_
94 #include <sys/vfsops.h>
95 #endif
96 #ifndef _SYS_UUID_H_
97 #include <sys/uuid.h>
98 #endif
99
100 /*
101  * Vnode types.  VNON means no type or transitory type.  VINT is used
102  * for internal types.  Note that VNON is skipped by the vnode scan.
103  */
104 enum vtype      { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD,
105                   VDATABASE, VINT };
106
107 /*
108  * Vnode tag types.
109  * These are for the benefit of external programs only (e.g., pstat)
110  * and should NEVER be inspected by the kernel.
111  */
112 enum vtagtype   {
113         VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_PC, VT_LFS, VT_LOFS, VT_FDESC,
114         VT_PORTAL, VT_NULL, VT_UNUSED10, VT_KERNFS, VT_PROCFS, VT_AFS,
115         VT_ISOFS, VT_UNION, VT_MSDOSFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS,
116         VT_HPFS, VT_NWFS, VT_SMBFS, VT_UDF, VT_EXT2FS, VT_SYNTH,
117         VT_USERFS, VT_HAMMER, VT_DEVFS, VT_TMPFS
118 };
119
120 /*
121  * Vnode attributes.  A field value of VNOVAL represents a field whose value
122  * is unavailable (getattr) or which is not to be changed (setattr).
123  *
124  * Some vattr fields may be wider then what is reported to userland.
125  */
126 struct vattr {
127         enum vtype      va_type;        /* vnode type (for create) */
128         u_int64_t       va_nlink;       /* number of references to file */
129         u_short         va_mode;        /* files access mode and type */
130         uid_t           va_uid;         /* owner user id */
131         gid_t           va_gid;         /* owner group id */
132         udev_t          va_fsid;        /* file system id */
133         ino_t           va_fileid;      /* file id */
134         u_quad_t        va_size;        /* file size in bytes */
135         long            va_blocksize;   /* blocksize preferred for i/o */
136         struct timespec va_atime;       /* time of last access */
137         struct timespec va_mtime;       /* time of last modification */
138         struct timespec va_ctime;       /* time file changed */
139         u_int64_t       va_gen;         /* generation number of file */
140         u_long          va_flags;       /* flags defined for file */
141         int             va_rmajor;      /* device the special file represents */
142         int             va_rminor;
143         u_quad_t        va_bytes;       /* bytes of disk space held by file */
144         u_quad_t        va_filerev;     /* file modification number */
145         u_int           va_vaflags;     /* operations flags, see below */
146         long            va_spare;       /* remain quad aligned */
147         int64_t         va_unused01;
148         uuid_t          va_uid_uuid;    /* native uuids if available */
149         uuid_t          va_gid_uuid;
150         uuid_t          va_fsid_uuid;
151 };
152
153 /*
154  * Flags for va_vaflags.
155  *
156  * NOTE: The short versions for the uid, gid, and fsid are always populated
157  * even when the uuid versions are available.
158  */
159 #define VA_UTIMES_NULL          0x0001  /* utimes argument was NULL */
160 #define VA_EXCLUSIVE            0x0002  /* exclusive create request */
161 #define VA_UID_UUID_VALID       0x0004  /* uuid fields also populated */
162 #define VA_GID_UUID_VALID       0x0008  /* uuid fields also populated */
163 #define VA_FSID_UUID_VALID      0x0010  /* uuid fields also populated */
164
165 #if 0   /* NOT YET */
166
167 /*
168  * The vfscache structure holds the system cacheable elements associated with 
169  * a file or device.  This structure is most typically embedded within a
170  * vnode.
171  */
172 struct vfscache {
173         int                     fc_flags;
174         struct vm_object        *fc_object;     /* cached data */
175         struct vattr            fc_attr;        /* cached attribute data */
176 };
177
178 #define FCF_ATTR_GOOD           0x00000001      /* FUTURE */
179 #define FCF_ATTR_ATIME          0x00010000      /* FUTURE attr modifications */
180 #define FCF_ATTR_MTIME          0x00020000      /* FUTURE attr modifications */
181 #define FCF_ATTR_CTIME          0x00040000      /* FUTURE attr modifications */
182 #define FCF_ATTR_UID            0x00080000      /* FUTURE attr modifications */
183 #define FCF_ATTR_GID            0x00100000      /* FUTURE attr modifications */
184 #define FCF_ATTR_SIZE           0x00200000      /* FUTURE attr modifications */
185
186 #endif
187
188 #endif
189