10dc332bfSKa Ho Ng.\" 2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause 30dc332bfSKa Ho Ng.\" 40dc332bfSKa Ho Ng.\" Copyright (c) 2021 The FreeBSD Foundation 50dc332bfSKa Ho Ng.\" 60dc332bfSKa Ho Ng.\" This manual page was written by Ka Ho Ng under sponsorship from 70dc332bfSKa Ho Ng.\" the FreeBSD Foundation. 80dc332bfSKa Ho Ng.\" 90dc332bfSKa Ho Ng.\" Redistribution and use in source and binary forms, with or without 100dc332bfSKa Ho Ng.\" modification, are permitted provided that the following conditions 110dc332bfSKa Ho Ng.\" are met: 120dc332bfSKa Ho Ng.\" 1. Redistributions of source code must retain the above copyright 130dc332bfSKa Ho Ng.\" notice, this list of conditions and the following disclaimer. 140dc332bfSKa Ho Ng.\" 2. Redistributions in binary form must reproduce the above copyright 150dc332bfSKa Ho Ng.\" notice, this list of conditions and the following disclaimer in the 160dc332bfSKa Ho Ng.\" documentation and/or other materials provided with the distribution. 170dc332bfSKa Ho Ng.\" 180dc332bfSKa Ho Ng.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 190dc332bfSKa Ho Ng.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 200dc332bfSKa Ho Ng.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 210dc332bfSKa Ho Ng.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 220dc332bfSKa Ho Ng.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 230dc332bfSKa Ho Ng.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 240dc332bfSKa Ho Ng.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 250dc332bfSKa Ho Ng.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 260dc332bfSKa Ho Ng.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 270dc332bfSKa Ho Ng.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 280dc332bfSKa Ho Ng.\" SUCH DAMAGE. 290dc332bfSKa Ho Ng.\" 309e202d03SKa Ho Ng.Dd August 25, 2021 310dc332bfSKa Ho Ng.Dt VN_DEALLOCATE 9 320dc332bfSKa Ho Ng.Os 330dc332bfSKa Ho Ng.Sh NAME 340dc332bfSKa Ho Ng.Nm vn_deallocate 350dc332bfSKa Ho Ng.Nd zero and/or deallocate storage from a file 360dc332bfSKa Ho Ng.Sh SYNOPSIS 370dc332bfSKa Ho Ng.In sys/param.h 380dc332bfSKa Ho Ng.In sys/vnode.h 390dc332bfSKa Ho Ng.Ft int 400dc332bfSKa Ho Ng.Fo vn_deallocate 410dc332bfSKa Ho Ng.Fa "struct vnode *vp" 420dc332bfSKa Ho Ng.Fa "off_t *offset" 430dc332bfSKa Ho Ng.Fa "off_t *length" 440dc332bfSKa Ho Ng.Fa "int flags" 454a9b832aSKa Ho Ng.Fa "int ioflag" 460dc332bfSKa Ho Ng.Fa "struct ucred *active_cred" 470dc332bfSKa Ho Ng.Fa "struct ucred *file_cred" 480dc332bfSKa Ho Ng.Fc 490dc332bfSKa Ho Ng.Sh DESCRIPTION 500dc332bfSKa Ho NgThe 510dc332bfSKa Ho Ng.Fn vn_deallocate 520dc332bfSKa Ho Ngfunction zeros and/or deallocates backing storage space from a file. 530dc332bfSKa Ho NgThis function only works on vnodes with 540dc332bfSKa Ho Ng.Dv VREG 550dc332bfSKa Ho Ngtype. 560dc332bfSKa Ho Ng.Pp 570dc332bfSKa Ho NgThe arguments are: 580dc332bfSKa Ho Ng.Bl -tag -width active_cred 590dc332bfSKa Ho Ng.It Fa vp 600dc332bfSKa Ho NgThe vnode of the file. 610dc332bfSKa Ho Ng.It Fa offset 620dc332bfSKa Ho NgThe starting offset of the operation range. 630dc332bfSKa Ho Ng.It Fa length 640dc332bfSKa Ho NgThe length of the operation range. 650dc332bfSKa Ho NgThis must be greater than 0. 660dc332bfSKa Ho Ng.It Fa flags 670dc332bfSKa Ho NgThe control flags of the operation. 680dc332bfSKa Ho NgThis should be set to 0 for now. 694a9b832aSKa Ho Ng.It Fa ioflag 70a638dc4eSKa Ho NgDirectives and hints to be given to the file system. 710dc332bfSKa Ho Ng.It Fa active_cred 720dc332bfSKa Ho NgThe user credentials of the calling thread. 730dc332bfSKa Ho Ng.It Fa file_cred 740dc332bfSKa Ho NgThe credentials installed on the file description pointing to the vnode or NOCRED. 750dc332bfSKa Ho Ng.El 760dc332bfSKa Ho Ng.Pp 770dc332bfSKa Ho NgThe 784a9b832aSKa Ho Ng.Fn ioflag 79a638dc4eSKa Ho Ngargument gives directives and hints to the file system. 80a638dc4eSKa Ho NgIt may include one or more of the following flags: 810dc332bfSKa Ho Ng.Bl -tag -width IO_RANGELOCKED 820dc332bfSKa Ho Ng.It Dv IO_NODELOCKED 830dc332bfSKa Ho NgThe vnode was locked before the call. 840dc332bfSKa Ho Ng.It Dv IO_RANGELOCKED 850dc332bfSKa Ho NgRangelock was owned around the call. 860dc332bfSKa Ho Ng.It Dv IO_NOMACCHECK 870dc332bfSKa Ho NgSkip MAC checking in the call. 88a638dc4eSKa Ho Ng.It Dv IO_SYNC 89a638dc4eSKa Ho NgDo I/O synchronously. 90a638dc4eSKa Ho Ng.It Dv IO_DIRECT 91a638dc4eSKa Ho NgAttempt to bypass buffer cache. 920dc332bfSKa Ho Ng.El 930dc332bfSKa Ho Ng.Pp 940dc332bfSKa Ho Ng.Fa *offset 950dc332bfSKa Ho Ngand 960dc332bfSKa Ho Ng.Fa *length 970dc332bfSKa Ho Ngare updated to reflect the unprocessed operation range of the call. 981eaa3652SKa Ho NgFor a successful completion, 991eaa3652SKa Ho Ng.Fa *length 1001eaa3652SKa Ho Ngis updated to be the value 0, and 1011eaa3652SKa Ho Ng.Fa *offset 1029e202d03SKa Ho Ngis incremented by the number of bytes zeroed before the end-of-file. 1030dc332bfSKa Ho Ng.Sh RETURN VALUES 1040dc332bfSKa Ho NgUpon successful completion, the value 0 is returned; otherwise the 1050dc332bfSKa Ho Ngappropriate error is returned. 1060dc332bfSKa Ho Ng.Sh SEE ALSO 1070dc332bfSKa Ho Ng.Xr vnode 9 , 1080dc332bfSKa Ho Ng.Xr VOP_DEALLOCATE 9 1090dc332bfSKa Ho Ng.Sh AUTHORS 1100dc332bfSKa Ho Ng.Nm 1110dc332bfSKa Ho Ngand this manual page was written by 1120dc332bfSKa Ho Ng.An Ka Ho Ng Aq Mt khng@FreeBSD.org 1130dc332bfSKa Ho Ngunder sponsorship from the FreeBSD Foundation. 114