1ea41f49fSJohn Baldwin.\" -*- nroff -*- 2ea41f49fSJohn Baldwin.\" 3179fa75eSJohn Baldwin.\" Copyright (c) 2013 Hudson River Trading LLC 4ea41f49fSJohn Baldwin.\" Written by: John H. Baldwin <jhb@FreeBSD.org> 5ea41f49fSJohn Baldwin.\" All rights reserved. 6ea41f49fSJohn Baldwin.\" 7ea41f49fSJohn Baldwin.\" Redistribution and use in source and binary forms, with or without 8ea41f49fSJohn Baldwin.\" modification, are permitted provided that the following conditions 9ea41f49fSJohn Baldwin.\" are met: 10ea41f49fSJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright 11ea41f49fSJohn Baldwin.\" notice, this list of conditions and the following disclaimer. 12ea41f49fSJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright 13ea41f49fSJohn Baldwin.\" notice, this list of conditions and the following disclaimer in the 14ea41f49fSJohn Baldwin.\" documentation and/or other materials provided with the distribution. 15ea41f49fSJohn Baldwin.\" 16ea41f49fSJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17ea41f49fSJohn Baldwin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18ea41f49fSJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19ea41f49fSJohn Baldwin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20ea41f49fSJohn Baldwin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21ea41f49fSJohn Baldwin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22ea41f49fSJohn Baldwin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23ea41f49fSJohn Baldwin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24ea41f49fSJohn Baldwin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25ea41f49fSJohn Baldwin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26ea41f49fSJohn Baldwin.\" SUCH DAMAGE. 27ea41f49fSJohn Baldwin.\" 28e19a95e5SMark Johnston.Dd September 26, 2015 29ea41f49fSJohn Baldwin.Dt VOP_ADVISE 9 30ea41f49fSJohn Baldwin.Os 31ea41f49fSJohn Baldwin.Sh NAME 32ea41f49fSJohn Baldwin.Nm VOP_ADVISE 33ea41f49fSJohn Baldwin.Nd apply advice about use of file data 34ea41f49fSJohn Baldwin.Sh SYNOPSIS 35ea41f49fSJohn Baldwin.In sys/param.h 36ea41f49fSJohn Baldwin.In sys/vnode.h 37ea41f49fSJohn Baldwin.Ft int 38ea41f49fSJohn Baldwin.Fn VOP_ADVISE "struct vnode *vp" "off_t start" "off_t end" "int advice" 39ea41f49fSJohn Baldwin.Sh DESCRIPTION 40ea41f49fSJohn BaldwinThis call applies advice for a range of a file's data. 41ea41f49fSJohn BaldwinIt is used to implement the 42*a51584a2SGraham Percival.Xr posix_fadvise 2 43ea41f49fSJohn Baldwinsystem call. 44ea41f49fSJohn Baldwin.Pp 45ea41f49fSJohn BaldwinIts arguments are: 46ea41f49fSJohn Baldwin.Bl -tag -width offset 47ea41f49fSJohn Baldwin.It Fa vp 48ea41f49fSJohn BaldwinThe vnode of the file. 49ea41f49fSJohn Baldwin.It Fa start 50ea41f49fSJohn BaldwinThe start of the range of file data. 51ea41f49fSJohn Baldwin.It Fa end 52ea41f49fSJohn BaldwinThe end of the range of file data. 53e19a95e5SMark JohnstonA value of 54e19a95e5SMark Johnston.Dv OFF_MAX 55e19a95e5SMark Johnstonindicates that the advice is to be applied up to the end of the file. 56ea41f49fSJohn Baldwin.It Fa advice 57ea41f49fSJohn BaldwinThe type of operation to apply to the file data. 58ea41f49fSJohn BaldwinPossible values are: 59ea41f49fSJohn Baldwin.Bl -tag -width POSIX_FADV_WILLNEED 60ea41f49fSJohn Baldwin.It Dv POSIX_FADV_WILLNEED 61ea41f49fSJohn BaldwinInitiate an asynchronous read of the file data if it is not already resident. 62ea41f49fSJohn Baldwin.It Dv POSIX_FADV_DONTNEED 63ea41f49fSJohn BaldwinDecrease the in-memory priority of clean file data or discard clean file data. 64ea41f49fSJohn Baldwin.El 65ea41f49fSJohn Baldwin.El 66ea41f49fSJohn Baldwin.Pp 67ea41f49fSJohn BaldwinIf the 68ea41f49fSJohn Baldwin.Fa start 69ea41f49fSJohn Baldwinand 70ea41f49fSJohn Baldwin.Fa end 71ea41f49fSJohn Baldwinoffsets are both zero, 72ea41f49fSJohn Baldwinthen the operation should be applied to the entire file. 73ea41f49fSJohn BaldwinNote that this call is advisory only and may perform the requested 74ea41f49fSJohn Baldwinoperation on a subset of the requested range 75ea41f49fSJohn Baldwin.Pq including not performing it at all 76ea41f49fSJohn Baldwinand still return success. 77ea41f49fSJohn Baldwin.Sh LOCKS 78ea41f49fSJohn BaldwinThe file should be unlocked on entry. 79ea41f49fSJohn Baldwin.Sh RETURN VALUES 80ea41f49fSJohn BaldwinZero is returned if the call is successful, otherwise an appropriate 81ea41f49fSJohn Baldwinerror code is returned. 82ea41f49fSJohn Baldwin.Sh ERRORS 83ea41f49fSJohn Baldwin.Bl -tag -width Er 84ea41f49fSJohn Baldwin.It Bq Er EINVAL 85ea41f49fSJohn BaldwinAn invalid value was given for 86ea41f49fSJohn Baldwin.Fa advice . 87ea41f49fSJohn Baldwin.El 88ea41f49fSJohn Baldwin.Sh SEE ALSO 89ea41f49fSJohn Baldwin.Xr vnode 9 90