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.\" $FreeBSD$ 29.\" 30.Dd September 26, 2015 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. 55A value of 56.Dv OFF_MAX 57indicates that the advice is to be applied up to the end of the file. 58.It Fa advice 59The type of operation to apply to the file data. 60Possible values are: 61.Bl -tag -width POSIX_FADV_WILLNEED 62.It Dv POSIX_FADV_WILLNEED 63Initiate an asynchronous read of the file data if it is not already resident. 64.It Dv POSIX_FADV_DONTNEED 65Decrease the in-memory priority of clean file data or discard clean file data. 66.El 67.El 68.Pp 69If the 70.Fa start 71and 72.Fa end 73offsets are both zero, 74then the operation should be applied to the entire file. 75Note that this call is advisory only and may perform the requested 76operation on a subset of the requested range 77.Pq including not performing it at all 78and still return success. 79.Sh LOCKS 80The file should be unlocked on entry. 81.Sh RETURN VALUES 82Zero is returned if the call is successful, otherwise an appropriate 83error code is returned. 84.Sh ERRORS 85.Bl -tag -width Er 86.It Bq Er EINVAL 87An invalid value was given for 88.Fa advice . 89.El 90.Sh SEE ALSO 91.Xr vnode 9 92