xref: /freebsd/share/man/man9/VOP_ALLOCATE.9 (revision ea41f49fc5516590544503f6d1a29a87ee62c485)
1*ea41f49fSJohn Baldwin.\" -*- nroff -*-
2*ea41f49fSJohn Baldwin.\"
3*ea41f49fSJohn Baldwin.\" Copyright (c) 2013 Advanced Computing Technologies LLC
4*ea41f49fSJohn Baldwin.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
5*ea41f49fSJohn Baldwin.\" All rights reserved.
6*ea41f49fSJohn Baldwin.\"
7*ea41f49fSJohn Baldwin.\" Redistribution and use in source and binary forms, with or without
8*ea41f49fSJohn Baldwin.\" modification, are permitted provided that the following conditions
9*ea41f49fSJohn Baldwin.\" are met:
10*ea41f49fSJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright
11*ea41f49fSJohn Baldwin.\"    notice, this list of conditions and the following disclaimer.
12*ea41f49fSJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright
13*ea41f49fSJohn Baldwin.\"    notice, this list of conditions and the following disclaimer in the
14*ea41f49fSJohn Baldwin.\"    documentation and/or other materials provided with the distribution.
15*ea41f49fSJohn Baldwin.\"
16*ea41f49fSJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*ea41f49fSJohn Baldwin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*ea41f49fSJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*ea41f49fSJohn Baldwin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*ea41f49fSJohn Baldwin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*ea41f49fSJohn Baldwin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*ea41f49fSJohn Baldwin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*ea41f49fSJohn Baldwin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*ea41f49fSJohn Baldwin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*ea41f49fSJohn Baldwin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*ea41f49fSJohn Baldwin.\" SUCH DAMAGE.
27*ea41f49fSJohn Baldwin.\"
28*ea41f49fSJohn Baldwin.\" $FreeBSD$
29*ea41f49fSJohn Baldwin.\"
30*ea41f49fSJohn Baldwin.Dd October 3, 2013
31*ea41f49fSJohn Baldwin.Dt VOP_ALLOCATE 9
32*ea41f49fSJohn Baldwin.Os
33*ea41f49fSJohn Baldwin.Sh NAME
34*ea41f49fSJohn Baldwin.Nm VOP_ALLOCATE
35*ea41f49fSJohn Baldwin.Nd allocate storage for a file
36*ea41f49fSJohn Baldwin.Sh SYNOPSIS
37*ea41f49fSJohn Baldwin.In sys/param.h
38*ea41f49fSJohn Baldwin.In sys/vnode.h
39*ea41f49fSJohn Baldwin.Ft int
40*ea41f49fSJohn Baldwin.Fn VOP_ALLOCATE "struct vnode *vp" "off_t *offset" "off_t *len"
41*ea41f49fSJohn Baldwin.Sh DESCRIPTION
42*ea41f49fSJohn BaldwinThis call allocates storage for a range of offsets in a file.
43*ea41f49fSJohn BaldwinIt is used to implement the
44*ea41f49fSJohn Baldwin.Xr posix_fallocate
45*ea41f49fSJohn Baldwinsystem call.
46*ea41f49fSJohn Baldwin.Pp
47*ea41f49fSJohn BaldwinIts arguments are:
48*ea41f49fSJohn Baldwin.Bl -tag -width offset
49*ea41f49fSJohn Baldwin.It Fa vp
50*ea41f49fSJohn BaldwinThe vnode of the file.
51*ea41f49fSJohn Baldwin.It Fa offset
52*ea41f49fSJohn BaldwinThe start of the range to allocate storage for in the file.
53*ea41f49fSJohn Baldwin.It Fa len
54*ea41f49fSJohn BaldwinThe length of the range to allocate storage for in the file.
55*ea41f49fSJohn Baldwin.El
56*ea41f49fSJohn Baldwin.Pp
57*ea41f49fSJohn BaldwinThe
58*ea41f49fSJohn Baldwin.Fa offset
59*ea41f49fSJohn Baldwinand
60*ea41f49fSJohn Baldwin.Fa len
61*ea41f49fSJohn Baldwinarguments are updated to reflect the portion of the range that
62*ea41f49fSJohn Baldwinstill needs to be allocated on return.
63*ea41f49fSJohn BaldwinA partial allocation is considered a successful operation.
64*ea41f49fSJohn BaldwinThe file's contents are not changed.
65*ea41f49fSJohn Baldwin.Sh LOCKS
66*ea41f49fSJohn BaldwinThe file should be exclusively locked on entry and will still be locked on exit.
67*ea41f49fSJohn Baldwin.Sh RETURN VALUES
68*ea41f49fSJohn BaldwinZero is returned if the call is successful, otherwise an appropriate
69*ea41f49fSJohn Baldwinerror code is returned.
70*ea41f49fSJohn Baldwin.Sh ERRORS
71*ea41f49fSJohn Baldwin.Bl -tag -width Er
72*ea41f49fSJohn Baldwin.It Bq Er EFBIG
73*ea41f49fSJohn BaldwinAn attempt was made to write a file that exceeds the process's file size
74*ea41f49fSJohn Baldwinlimit or the maximum file size.
75*ea41f49fSJohn Baldwin.It Bq Er ENOSPC
76*ea41f49fSJohn BaldwinThe file system is full.
77*ea41f49fSJohn Baldwin.It Bq Er EPERM
78*ea41f49fSJohn BaldwinAn append-only flag is set on the file, but the caller is attempting to
79*ea41f49fSJohn Baldwinwrite before the current end of file.
80*ea41f49fSJohn Baldwin.El
81*ea41f49fSJohn Baldwin.Sh SEE ALSO
82*ea41f49fSJohn Baldwin.Xr vnode 9 ,
83*ea41f49fSJohn Baldwin.Xr VOP_READ 9 ,
84*ea41f49fSJohn Baldwin.Xr VOP_WRITE 9
85