| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: vnode.h,v 1.257 2016/01/22 22:43:25 dholland Exp $ */ | | 1 | /* $NetBSD: vnode.h,v 1.258 2016/01/23 16:02:09 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -58,33 +58,35 @@ | | | @@ -58,33 +58,35 @@ |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #ifndef _SYS_VNODE_H_ | | 60 | #ifndef _SYS_VNODE_H_ |
61 | #define _SYS_VNODE_H_ | | 61 | #define _SYS_VNODE_H_ |
62 | | | 62 | |
63 | #include <sys/event.h> | | 63 | #include <sys/event.h> |
64 | #include <sys/queue.h> | | 64 | #include <sys/queue.h> |
65 | #include <sys/condvar.h> | | 65 | #include <sys/condvar.h> |
66 | #include <sys/rwlock.h> | | 66 | #include <sys/rwlock.h> |
67 | #include <sys/mutex.h> | | 67 | #include <sys/mutex.h> |
68 | #include <sys/time.h> | | 68 | #include <sys/time.h> |
69 | | | 69 | |
70 | /* XXX: clean up includes later */ | | 70 | /* XXX: clean up includes later */ |
| | | 71 | #if defined(_KERNEL) || defined(_KMEMUSER) |
71 | #include <uvm/uvm_param.h> /* XXX */ | | 72 | #include <uvm/uvm_param.h> /* XXX */ |
72 | #include <uvm/uvm_pglist.h> /* XXX */ | | 73 | #include <uvm/uvm_pglist.h> /* XXX */ |
73 | #include <uvm/uvm_object.h> /* XXX */ | | 74 | #include <uvm/uvm_object.h> /* XXX */ |
74 | #include <uvm/uvm_extern.h> /* XXX */ | | 75 | #include <uvm/uvm_extern.h> /* XXX */ |
75 | | | 76 | |
76 | struct namecache; | | 77 | struct namecache; |
77 | struct uvm_ractx; | | 78 | struct uvm_ractx; |
| | | 79 | #endif |
78 | | | 80 | |
79 | /* | | 81 | /* |
80 | * The vnode is the focus of all file activity in UNIX. There is a | | 82 | * The vnode is the focus of all file activity in UNIX. There is a |
81 | * unique vnode allocated for each active file, each current directory, | | 83 | * unique vnode allocated for each active file, each current directory, |
82 | * each mounted-on file, text file, and the root. | | 84 | * each mounted-on file, text file, and the root. |
83 | */ | | 85 | */ |
84 | | | 86 | |
85 | /* | | 87 | /* |
86 | * Vnode types. VNON means no type. | | 88 | * Vnode types. VNON means no type. |
87 | */ | | 89 | */ |
88 | enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; | | 90 | enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; |
89 | | | 91 | |
90 | #define VNODE_TYPES \ | | 92 | #define VNODE_TYPES \ |
| @@ -102,26 +104,27 @@ enum vtagtype { | | | @@ -102,26 +104,27 @@ enum vtagtype { |
102 | VT_FILECORE, VT_NTFS, VT_VFS, VT_OVERLAY, VT_SMBFS, VT_PTYFS, | | 104 | VT_FILECORE, VT_NTFS, VT_VFS, VT_OVERLAY, VT_SMBFS, VT_PTYFS, |
103 | VT_TMPFS, VT_UDF, VT_SYSVBFS, VT_PUFFS, VT_HFS, VT_EFS, VT_ZFS, | | 105 | VT_TMPFS, VT_UDF, VT_SYSVBFS, VT_PUFFS, VT_HFS, VT_EFS, VT_ZFS, |
104 | VT_RUMP, VT_NILFS, VT_V7FS, VT_CHFS | | 106 | VT_RUMP, VT_NILFS, VT_V7FS, VT_CHFS |
105 | }; | | 107 | }; |
106 | | | 108 | |
107 | #define VNODE_TAGS \ | | 109 | #define VNODE_TAGS \ |
108 | "VT_NON", "VT_UFS", "VT_NFS", "VT_MFS", "VT_MSDOSFS", "VT_LFS", "VT_LOFS", \ | | 110 | "VT_NON", "VT_UFS", "VT_NFS", "VT_MFS", "VT_MSDOSFS", "VT_LFS", "VT_LOFS", \ |
109 | "VT_FDESC", "VT_PORTAL", "VT_NULL", "VT_UMAP", "VT_KERNFS", "VT_PROCFS", \ | | 111 | "VT_FDESC", "VT_PORTAL", "VT_NULL", "VT_UMAP", "VT_KERNFS", "VT_PROCFS", \ |
110 | "VT_AFS", "VT_ISOFS", "VT_UNION", "VT_ADOSFS", "VT_EXT2FS", "VT_CODA", \ | | 112 | "VT_AFS", "VT_ISOFS", "VT_UNION", "VT_ADOSFS", "VT_EXT2FS", "VT_CODA", \ |
111 | "VT_FILECORE", "VT_NTFS", "VT_VFS", "VT_OVERLAY", "VT_SMBFS", "VT_PTYFS", \ | | 113 | "VT_FILECORE", "VT_NTFS", "VT_VFS", "VT_OVERLAY", "VT_SMBFS", "VT_PTYFS", \ |
112 | "VT_TMPFS", "VT_UDF", "VT_SYSVBFS", "VT_PUFFS", "VT_HFS", "VT_EFS", \ | | 114 | "VT_TMPFS", "VT_UDF", "VT_SYSVBFS", "VT_PUFFS", "VT_HFS", "VT_EFS", \ |
113 | "VT_ZFS", "VT_RUMP", "VT_NILFS", "VT_V7FS", "VT_CHFS" | | 115 | "VT_ZFS", "VT_RUMP", "VT_NILFS", "VT_V7FS", "VT_CHFS" |
114 | | | 116 | |
| | | 117 | #if defined(_KERNEL) || defined(_KMEMUSER) |
115 | struct vnode; | | 118 | struct vnode; |
116 | struct buf; | | 119 | struct buf; |
117 | | | 120 | |
118 | LIST_HEAD(buflists, buf); | | 121 | LIST_HEAD(buflists, buf); |
119 | TAILQ_HEAD(vnodelst, vnode); | | 122 | TAILQ_HEAD(vnodelst, vnode); |
120 | | | 123 | |
121 | /* | | 124 | /* |
122 | * Reading or writing any of these items requires holding the appropriate | | 125 | * Reading or writing any of these items requires holding the appropriate |
123 | * lock. Field markings and the corresponding locks: | | 126 | * lock. Field markings and the corresponding locks: |
124 | * | | 127 | * |
125 | * : stable, reference to the vnode is required | | 128 | * : stable, reference to the vnode is required |
126 | * f vnode_free_list_lock, or vrele_lock for vrele_list | | 129 | * f vnode_free_list_lock, or vrele_lock for vrele_list |
127 | * i v_interlock | | 130 | * i v_interlock |
| @@ -170,26 +173,27 @@ struct vnode { | | | @@ -170,26 +173,27 @@ struct vnode { |
170 | void *v_data; /* :: private data for fs */ | | 173 | void *v_data; /* :: private data for fs */ |
171 | struct klist v_klist; /* i: notes attached to vnode */ | | 174 | struct klist v_klist; /* i: notes attached to vnode */ |
172 | }; | | 175 | }; |
173 | #define v_usecount v_uobj.uo_refs | | 176 | #define v_usecount v_uobj.uo_refs |
174 | #define v_interlock v_uobj.vmobjlock | | 177 | #define v_interlock v_uobj.vmobjlock |
175 | #define v_mountedhere v_un.vu_mountedhere | | 178 | #define v_mountedhere v_un.vu_mountedhere |
176 | #define v_socket v_un.vu_socket | | 179 | #define v_socket v_un.vu_socket |
177 | #define v_specnode v_un.vu_specnode | | 180 | #define v_specnode v_un.vu_specnode |
178 | #define v_fifoinfo v_un.vu_fifoinfo | | 181 | #define v_fifoinfo v_un.vu_fifoinfo |
179 | #define v_ractx v_un.vu_ractx | | 182 | #define v_ractx v_un.vu_ractx |
180 | | | 183 | |
181 | typedef struct vnodelst vnodelst_t; | | 184 | typedef struct vnodelst vnodelst_t; |
182 | typedef struct vnode vnode_t; | | 185 | typedef struct vnode vnode_t; |
| | | 186 | #endif |
183 | | | 187 | |
184 | /* | | 188 | /* |
185 | * Vnode flags. The first set are locked by vnode lock or are stable. | | 189 | * Vnode flags. The first set are locked by vnode lock or are stable. |
186 | * VSYSTEM is only used to skip vflush()ing quota files. VISTTY is used | | 190 | * VSYSTEM is only used to skip vflush()ing quota files. VISTTY is used |
187 | * when reading dead vnodes. | | 191 | * when reading dead vnodes. |
188 | */ | | 192 | */ |
189 | #define VV_ROOT 0x00000001 /* root of its file system */ | | 193 | #define VV_ROOT 0x00000001 /* root of its file system */ |
190 | #define VV_SYSTEM 0x00000002 /* vnode being used by kernel */ | | 194 | #define VV_SYSTEM 0x00000002 /* vnode being used by kernel */ |
191 | #define VV_ISTTY 0x00000004 /* vnode represents a tty */ | | 195 | #define VV_ISTTY 0x00000004 /* vnode represents a tty */ |
192 | #define VV_MAPPED 0x00000008 /* vnode might have user mappings */ | | 196 | #define VV_MAPPED 0x00000008 /* vnode might have user mappings */ |
193 | #define VV_MPSAFE 0x00000010 /* file system code is MP safe */ | | 197 | #define VV_MPSAFE 0x00000010 /* file system code is MP safe */ |
194 | #define VV_LOCKSWORK 0x00000020 /* FS supports locking discipline */ | | 198 | #define VV_LOCKSWORK 0x00000020 /* FS supports locking discipline */ |
195 | | | 199 | |