1*8f128fcdSmpi.\" $OpenBSD: uvn_attach.9,v 1.1 2019/12/05 15:14:28 mpi Exp $ 2*8f128fcdSmpi.\" $NetBSD: uvm.9,v 1.14 2000/06/29 06:08:44 mrg Exp $ 3*8f128fcdSmpi.\" 4*8f128fcdSmpi.\" Copyright (c) 1998 Matthew R. Green 5*8f128fcdSmpi.\" All rights reserved. 6*8f128fcdSmpi.\" 7*8f128fcdSmpi.\" Redistribution and use in source and binary forms, with or without 8*8f128fcdSmpi.\" modification, are permitted provided that the following conditions 9*8f128fcdSmpi.\" are met: 10*8f128fcdSmpi.\" 1. Redistributions of source code must retain the above copyright 11*8f128fcdSmpi.\" notice, this list of conditions and the following disclaimer. 12*8f128fcdSmpi.\" 2. Redistributions in binary form must reproduce the above copyright 13*8f128fcdSmpi.\" notice, this list of conditions and the following disclaimer in the 14*8f128fcdSmpi.\" documentation and/or other materials provided with the distribution. 15*8f128fcdSmpi.\" 16*8f128fcdSmpi.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*8f128fcdSmpi.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*8f128fcdSmpi.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*8f128fcdSmpi.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*8f128fcdSmpi.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21*8f128fcdSmpi.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22*8f128fcdSmpi.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23*8f128fcdSmpi.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24*8f128fcdSmpi.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*8f128fcdSmpi.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*8f128fcdSmpi.\" SUCH DAMAGE. 27*8f128fcdSmpi.\" 28*8f128fcdSmpi.Dd $Mdocdate: December 5 2019 $ 29*8f128fcdSmpi.Dt UVN_ATTACH 9 30*8f128fcdSmpi.Os 31*8f128fcdSmpi.Sh NAME 32*8f128fcdSmpi.Nm uvn_attach , 33*8f128fcdSmpi.Nm uvm_vnp_setsize , 34*8f128fcdSmpi.Nm uvm_vnp_sync , 35*8f128fcdSmpi.Nm uvm_vnp_terminate , 36*8f128fcdSmpi.Nm uvm_vnp_uncache 37*8f128fcdSmpi.Nd memory mapping files and devices 38*8f128fcdSmpi.Sh SYNOPSIS 39*8f128fcdSmpi.In sys/param.h 40*8f128fcdSmpi.In uvm/uvm.h 41*8f128fcdSmpi.Ft struct uvm_object * 42*8f128fcdSmpi.Fn uvn_attach "struct vnode *vp" "vm_prot_t accessprot" 43*8f128fcdSmpi.Ft void 44*8f128fcdSmpi.Fn uvm_vnp_setsize "struct vnode *vp" "voff_t newsize" 45*8f128fcdSmpi.Ft void 46*8f128fcdSmpi.Fn uvm_vnp_sync "struct mount *mp" 47*8f128fcdSmpi.Ft void 48*8f128fcdSmpi.Fn uvm_vnp_terminate "struct vnode *vp" 49*8f128fcdSmpi.Ft boolean_t 50*8f128fcdSmpi.Fn uvm_vnp_uncache "struct vnode *vp" 51*8f128fcdSmpi.Sh DESCRIPTION 52*8f128fcdSmpiThe 53*8f128fcdSmpi.Fn uvn_attach 54*8f128fcdSmpifunction attaches a UVM object to vnode 55*8f128fcdSmpi.Fa vp , 56*8f128fcdSmpicreating the object if necessary. 57*8f128fcdSmpiThe object is returned. 58*8f128fcdSmpi.Pp 59*8f128fcdSmpiThe 60*8f128fcdSmpi.Fn uvm_vnp_setsize 61*8f128fcdSmpifunction sets the size of vnode 62*8f128fcdSmpi.Fa vp 63*8f128fcdSmpito 64*8f128fcdSmpi.Fa newsize . 65*8f128fcdSmpiCaller must hold a reference to the vnode. 66*8f128fcdSmpiIf the vnode shrinks, pages no longer used are discarded. 67*8f128fcdSmpiThis function will be removed when the file system and VM buffer caches 68*8f128fcdSmpiare merged. 69*8f128fcdSmpi.Pp 70*8f128fcdSmpiThe 71*8f128fcdSmpi.Fn uvm_vnp_sync 72*8f128fcdSmpifunction flushes dirty vnodes from either the mount point passed in 73*8f128fcdSmpi.Fa mp , 74*8f128fcdSmpior all dirty vnodes if 75*8f128fcdSmpi.Fa mp 76*8f128fcdSmpiis 77*8f128fcdSmpi.Dv NULL . 78*8f128fcdSmpiThis function will be removed when the file system and VM buffer caches 79*8f128fcdSmpiare merged. 80*8f128fcdSmpi.Pp 81*8f128fcdSmpiThe 82*8f128fcdSmpi.Fn uvm_vnp_terminate 83*8f128fcdSmpifunction frees all VM resources allocated to vnode 84*8f128fcdSmpi.Fa vp . 85*8f128fcdSmpiIf the vnode still has references, it will not be destroyed; however 86*8f128fcdSmpiall future operations using this vnode will fail. 87*8f128fcdSmpiThis function will be removed when the file system and VM buffer caches 88*8f128fcdSmpiare merged. 89*8f128fcdSmpi.Pp 90*8f128fcdSmpiThe 91*8f128fcdSmpi.Fn uvm_vnp_uncache 92*8f128fcdSmpifunction disables vnode 93*8f128fcdSmpi.Fa vp 94*8f128fcdSmpifrom persisting when all references are freed. 95*8f128fcdSmpiThis function will be removed when the file system and UVM caches 96*8f128fcdSmpiare unified. 97*8f128fcdSmpiReturns true if there is no active vnode. 98*8f128fcdSmpi.Sh SEE ALSO 99*8f128fcdSmpi.Xr uvm_init 9 100