1*45794745Smpi /* $OpenBSD: uvm_vnode.h,v 1.21 2022/10/20 13:31:52 mpi Exp $ */ 21414b0faSart /* $NetBSD: uvm_vnode.h,v 1.9 2000/03/26 20:54:48 kleink Exp $ */ 31414b0faSart 41414b0faSart /* 51414b0faSart * 61414b0faSart * Copyright (c) 1997 Charles D. Cranor and Washington University. 71414b0faSart * All rights reserved. 81414b0faSart * 91414b0faSart * Redistribution and use in source and binary forms, with or without 101414b0faSart * modification, are permitted provided that the following conditions 111414b0faSart * are met: 121414b0faSart * 1. Redistributions of source code must retain the above copyright 131414b0faSart * notice, this list of conditions and the following disclaimer. 141414b0faSart * 2. Redistributions in binary form must reproduce the above copyright 151414b0faSart * notice, this list of conditions and the following disclaimer in the 161414b0faSart * documentation and/or other materials provided with the distribution. 171414b0faSart * 3. All advertising materials mentioning features or use of this software 181414b0faSart * must display the following acknowledgement: 191414b0faSart * This product includes software developed by Charles D. Cranor and 201414b0faSart * Washington University. 211414b0faSart * 4. The name of the author may not be used to endorse or promote products 221414b0faSart * derived from this software without specific prior written permission. 231414b0faSart * 241414b0faSart * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 251414b0faSart * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 261414b0faSart * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 271414b0faSart * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 281414b0faSart * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 291414b0faSart * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 301414b0faSart * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 311414b0faSart * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 321414b0faSart * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 331414b0faSart * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 341414b0faSart * 351414b0faSart * from: Id: uvm_vnode.h,v 1.1.2.4 1997/10/03 21:18:24 chuck Exp 361414b0faSart */ 371414b0faSart 381414b0faSart #ifndef _UVM_UVM_VNODE_H_ 391414b0faSart #define _UVM_UVM_VNODE_H_ 401414b0faSart 411414b0faSart /* 421414b0faSart * uvm_vnode.h 431414b0faSart * 441414b0faSart * vnode handle into the VM system. 451414b0faSart */ 461414b0faSart 47fde894e5Stedu struct vnode; 48fde894e5Stedu 49*45794745Smpi /* 50*45794745Smpi * the uvm_vnode structure. 51*45794745Smpi * 52*45794745Smpi * Locks used to protect struct members in this file: 53*45794745Smpi * I immutable after creation 54*45794745Smpi * K kernel lock 55*45794745Smpi * S uvn_sync_lock 56*45794745Smpi * v u_obj's vmobjlock 57*45794745Smpi */ 581414b0faSart struct uvm_vnode { 591414b0faSart struct uvm_object u_obj; /* the actual VM object */ 60*45794745Smpi struct vnode *u_vnode; /* [I] pointer back to vnode */ 61*45794745Smpi int u_flags; /* [v] flags */ 62*45794745Smpi int u_nio; /* [v] number of running I/O requests */ 63*45794745Smpi voff_t u_size; /* [v] size of object */ 641414b0faSart 65*45794745Smpi LIST_ENTRY(uvm_vnode) u_wlist; /* [K] list of writeable vnode objs */ 661414b0faSart 67*45794745Smpi SIMPLEQ_ENTRY(uvm_vnode) u_syncq; /* [S] vnode objs due for a "sync" */ 681414b0faSart }; 691414b0faSart 701414b0faSart /* 711414b0faSart * u_flags values 721414b0faSart */ 731414b0faSart #define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */ 74129220cbSmpi #define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */ 751414b0faSart #define UVM_VNODE_ALOCK 0x004 /* uvn_attach is locked out */ 761414b0faSart #define UVM_VNODE_DYING 0x008 /* final detach/terminate in 771414b0faSart progress */ 781414b0faSart #define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg 791414b0faSart when final i/o is done */ 801414b0faSart #define UVM_VNODE_WANTED 0x020 /* someone is waiting for alock, 811414b0faSart dying, or relkill to clear */ 821414b0faSart #define UVM_VNODE_VNISLOCKED 0x040 /* underlying vnode struct is locked 831414b0faSart (valid when DYING is true) */ 841414b0faSart #define UVM_VNODE_IOSYNC 0x080 /* I/O sync in progress ... setter 851414b0faSart sleeps on &uvn->u_nio */ 861414b0faSart #define UVM_VNODE_IOSYNCWANTED 0x100 /* a process is waiting for the 871414b0faSart i/o sync to clear so it can do 881414b0faSart i/o */ 891414b0faSart #define UVM_VNODE_WRITEABLE 0x200 /* uvn has pages that are writeable */ 901414b0faSart 911414b0faSart /* 921414b0faSart * UVM_VNODE_BLOCKED: any condition that should new processes from 931414b0faSart * touching the vnode [set WANTED and sleep to wait for it to clear] 941414b0faSart */ 951414b0faSart #define UVM_VNODE_BLOCKED (UVM_VNODE_ALOCK|UVM_VNODE_DYING|UVM_VNODE_RELKILL) 961414b0faSart 971414b0faSart #endif /* _UVM_UVM_VNODE_H_ */ 98