xref: /freebsd/share/man/man9/VOP_ADVISE.9 (revision 09d325677d53a12c79a43664ff29871e92247629)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2013 Advanced Computing Technologies LLC
4.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
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 AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, 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.\" $FreeBSD$
29.\"
30.Dd October 3, 2013
31.Dt VOP_ADVISE 9
32.Os
33.Sh NAME
34.Nm VOP_ADVISE
35.Nd apply advice about use of file data
36.Sh SYNOPSIS
37.In sys/param.h
38.In sys/vnode.h
39.Ft int
40.Fn VOP_ADVISE "struct vnode *vp" "off_t start" "off_t end" "int advice"
41.Sh DESCRIPTION
42This call applies advice for a range of a file's data.
43It is used to implement the
44.Xr posix_fadvise
45system call.
46.Pp
47Its arguments are:
48.Bl -tag -width offset
49.It Fa vp
50The vnode of the file.
51.It Fa start
52The start of the range of file data.
53.It Fa end
54The end of the range of file data.
55.It Fa advice
56The type of operation to apply to the file data.
57Possible values are:
58.Bl -tag -width POSIX_FADV_WILLNEED
59.It Dv POSIX_FADV_WILLNEED
60Initiate an asynchronous read of the file data if it is not already resident.
61.It Dv POSIX_FADV_DONTNEED
62Decrease the in-memory priority of clean file data or discard clean file data.
63.El
64.El
65.Pp
66If the
67.Fa start
68and
69.Fa end
70offsets are both zero,
71then the operation should be applied to the entire file.
72Note that this call is advisory only and may perform the requested
73operation on a subset of the requested range
74.Pq including not performing it at all
75and still return success.
76.Sh LOCKS
77The file should be unlocked on entry.
78.Sh RETURN VALUES
79Zero is returned if the call is successful, otherwise an appropriate
80error code is returned.
81.Sh ERRORS
82.Bl -tag -width Er
83.It Bq Er EINVAL
84An invalid value was given for
85.Fa advice .
86.El
87.Sh SEE ALSO
88.Xr vnode 9
89