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