1 /* $OpenBSD: uvm_vnode.h,v 1.14 2014/12/16 18:30:04 tedu 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. 49 */ 50 51 struct vnode; 52 53 struct uvm_vnode { 54 struct uvm_object u_obj; /* the actual VM object */ 55 struct vnode *u_vnode; /* pointer back to vnode */ 56 int u_flags; /* flags */ 57 int u_nio; /* number of running I/O requests */ 58 voff_t u_size; /* size of object */ 59 60 /* the following entry is locked by uvn_wl_lock */ 61 LIST_ENTRY(uvm_vnode) u_wlist; /* list of writeable vnode objects */ 62 63 /* the following entry is locked by uvn_sync_lock */ 64 SIMPLEQ_ENTRY(uvm_vnode) u_syncq; /* vnode objects due for a "sync" */ 65 }; 66 67 /* 68 * u_flags values 69 */ 70 #define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */ 71 #define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */ 72 #define UVM_VNODE_ALOCK 0x004 /* uvn_attach is locked out */ 73 #define UVM_VNODE_DYING 0x008 /* final detach/terminate in 74 progress */ 75 #define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg 76 when final i/o is done */ 77 #define UVM_VNODE_WANTED 0x020 /* someone is waiting for alock, 78 dying, or relkill to clear */ 79 #define UVM_VNODE_VNISLOCKED 0x040 /* underlying vnode struct is locked 80 (valid when DYING is true) */ 81 #define UVM_VNODE_IOSYNC 0x080 /* I/O sync in progress ... setter 82 sleeps on &uvn->u_nio */ 83 #define UVM_VNODE_IOSYNCWANTED 0x100 /* a process is waiting for the 84 i/o sync to clear so it can do 85 i/o */ 86 #define UVM_VNODE_WRITEABLE 0x200 /* uvn has pages that are writeable */ 87 88 /* 89 * UVM_VNODE_BLOCKED: any condition that should new processes from 90 * touching the vnode [set WANTED and sleep to wait for it to clear] 91 */ 92 #define UVM_VNODE_BLOCKED (UVM_VNODE_ALOCK|UVM_VNODE_DYING|UVM_VNODE_RELKILL) 93 94 #endif /* _UVM_UVM_VNODE_H_ */ 95