xref: /freebsd/share/man/man9/VOP_ADVISE.9 (revision 2008043f386721d58158e37e0d7e50df8095942d)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2013 Hudson River Trading 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.Dd September 26, 2015
29.Dt VOP_ADVISE 9
30.Os
31.Sh NAME
32.Nm VOP_ADVISE
33.Nd apply advice about use of file data
34.Sh SYNOPSIS
35.In sys/param.h
36.In sys/vnode.h
37.Ft int
38.Fn VOP_ADVISE "struct vnode *vp" "off_t start" "off_t end" "int advice"
39.Sh DESCRIPTION
40This call applies advice for a range of a file's data.
41It is used to implement the
42.Xr posix_fadvise
43system call.
44.Pp
45Its arguments are:
46.Bl -tag -width offset
47.It Fa vp
48The vnode of the file.
49.It Fa start
50The start of the range of file data.
51.It Fa end
52The end of the range of file data.
53A value of
54.Dv OFF_MAX
55indicates that the advice is to be applied up to the end of the file.
56.It Fa advice
57The type of operation to apply to the file data.
58Possible values are:
59.Bl -tag -width POSIX_FADV_WILLNEED
60.It Dv POSIX_FADV_WILLNEED
61Initiate an asynchronous read of the file data if it is not already resident.
62.It Dv POSIX_FADV_DONTNEED
63Decrease the in-memory priority of clean file data or discard clean file data.
64.El
65.El
66.Pp
67If the
68.Fa start
69and
70.Fa end
71offsets are both zero,
72then the operation should be applied to the entire file.
73Note that this call is advisory only and may perform the requested
74operation on a subset of the requested range
75.Pq including not performing it at all
76and still return success.
77.Sh LOCKS
78The file should be unlocked on entry.
79.Sh RETURN VALUES
80Zero is returned if the call is successful, otherwise an appropriate
81error code is returned.
82.Sh ERRORS
83.Bl -tag -width Er
84.It Bq Er EINVAL
85An invalid value was given for
86.Fa advice .
87.El
88.Sh SEE ALSO
89.Xr vnode 9
90