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