freebsd-src/share/man/man9/vn_deallocate.9
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00

114 lines
3.4 KiB
Groff

.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2021 The FreeBSD Foundation
.\"
.\" This manual page was written by Ka Ho Ng under sponsorship from
.\" the FreeBSD Foundation.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 25, 2021
.Dt VN_DEALLOCATE 9
.Os
.Sh NAME
.Nm vn_deallocate
.Nd zero and/or deallocate storage from a file
.Sh SYNOPSIS
.In sys/param.h
.In sys/vnode.h
.Ft int
.Fo vn_deallocate
.Fa "struct vnode *vp"
.Fa "off_t *offset"
.Fa "off_t *length"
.Fa "int flags"
.Fa "int ioflag"
.Fa "struct ucred *active_cred"
.Fa "struct ucred *file_cred"
.Fc
.Sh DESCRIPTION
The
.Fn vn_deallocate
function zeros and/or deallocates backing storage space from a file.
This function only works on vnodes with
.Dv VREG
type.
.Pp
The arguments are:
.Bl -tag -width active_cred
.It Fa vp
The vnode of the file.
.It Fa offset
The starting offset of the operation range.
.It Fa length
The length of the operation range.
This must be greater than 0.
.It Fa flags
The control flags of the operation.
This should be set to 0 for now.
.It Fa ioflag
Directives and hints to be given to the file system.
.It Fa active_cred
The user credentials of the calling thread.
.It Fa file_cred
The credentials installed on the file description pointing to the vnode or NOCRED.
.El
.Pp
The
.Fn ioflag
argument gives directives and hints to the file system.
It may include one or more of the following flags:
.Bl -tag -width IO_RANGELOCKED
.It Dv IO_NODELOCKED
The vnode was locked before the call.
.It Dv IO_RANGELOCKED
Rangelock was owned around the call.
.It Dv IO_NOMACCHECK
Skip MAC checking in the call.
.It Dv IO_SYNC
Do I/O synchronously.
.It Dv IO_DIRECT
Attempt to bypass buffer cache.
.El
.Pp
.Fa *offset
and
.Fa *length
are updated to reflect the unprocessed operation range of the call.
For a successful completion,
.Fa *length
is updated to be the value 0, and
.Fa *offset
is incremented by the number of bytes zeroed before the end-of-file.
.Sh RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the
appropriate error is returned.
.Sh SEE ALSO
.Xr vnode 9 ,
.Xr VOP_DEALLOCATE 9
.Sh AUTHORS
.Nm
and this manual page was written by
.An Ka Ho Ng Aq Mt khng@FreeBSD.org
under sponsorship from the FreeBSD Foundation.