1 /* $OpenBSD: uvm_vnode.h,v 1.13 2014/06/29 22:56:31 deraadt Exp $ */ 2 /* $NetBSD: uvm_vnode.h,v 1.9 2000/03/26 20:54:48 kleink Exp $ */ 3 4 /* 5 * 6 * Copyright (c) 1997 Charles D. Cranor and Washington University. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Charles D. Cranor and 20 * Washington University. 21 * 4. The name of the author may not be used to endorse or promote products 22 * derived from this software without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * 35 * from: Id: uvm_vnode.h,v 1.1.2.4 1997/10/03 21:18:24 chuck Exp 36 */ 37 38 #ifndef _UVM_UVM_VNODE_H_ 39 #define _UVM_UVM_VNODE_H_ 40 41 /* 42 * uvm_vnode.h 43 * 44 * vnode handle into the VM system. 45 */ 46 47 /* 48 * the uvm_vnode structure. put at the top of the vnode data structure. 49 * this allows: 50 * (struct vnode *) == (struct uvm_vnode *) == (struct uvm_object *) 51 */ 52 53 struct uvm_vnode { 54 struct uvm_object u_obj; /* the actual VM object */ 55 int u_flags; /* flags */ 56 int u_nio; /* number of running I/O requests */ 57 voff_t u_size; /* size of object */ 58 59 /* the following entry is locked by uvn_wl_lock */ 60 LIST_ENTRY(uvm_vnode) u_wlist; /* list of writeable vnode objects */ 61 62 /* the following entry is locked by uvn_sync_lock */ 63 SIMPLEQ_ENTRY(uvm_vnode) u_syncq; /* vnode objects due for a "sync" */ 64 }; 65 66 /* 67 * u_flags values 68 */ 69 #define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */ 70 #define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */ 71 #define UVM_VNODE_ALOCK 0x004 /* uvn_attach is locked out */ 72 #define UVM_VNODE_DYING 0x008 /* final detach/terminate in 73 progress */ 74 #define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg 75 when final i/o is done */ 76 #define UVM_VNODE_WANTED 0x020 /* someone is waiting for alock, 77 dying, or relkill to clear */ 78 #define UVM_VNODE_VNISLOCKED 0x040 /* underlying vnode struct is locked 79 (valid when DYING is true) */ 80 #define UVM_VNODE_IOSYNC 0x080 /* I/O sync in progress ... setter 81 sleeps on &uvn->u_nio */ 82 #define UVM_VNODE_IOSYNCWANTED 0x100 /* a process is waiting for the 83 i/o sync to clear so it can do 84 i/o */ 85 #define UVM_VNODE_WRITEABLE 0x200 /* uvn has pages that are writeable */ 86 87 /* 88 * UVM_VNODE_BLOCKED: any condition that should new processes from 89 * touching the vnode [set WANTED and sleep to wait for it to clear] 90 */ 91 #define UVM_VNODE_BLOCKED (UVM_VNODE_ALOCK|UVM_VNODE_DYING|UVM_VNODE_RELKILL) 92 93 #endif /* _UVM_UVM_VNODE_H_ */ 94