1.\" $OpenBSD: vinvalbuf.9,v 1.7 2007/05/31 19:20:01 jmc Exp $ 2.\" 3.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice(s), this list of conditions and the following disclaimer as 10.\" the first lines of this file unmodified other than the possible 11.\" addition of one or more copyright notices. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice(s), 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 COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 17.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23.\" 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 SUCH 26.\" DAMAGE. 27.\" 28.\" $FreeBSD: src/share/man/man9/vinvalbuf.9,v 1.6 2001/10/06 11:19:41 sheldonh Exp $ 29.\" 30.Dd $Mdocdate: May 31 2007 $ 31.Dt VINVALBUF 9 32.Os 33.Sh NAME 34.Nm vinvalbuf 35.Nd flush and invalidate all buffers associated with a vnode 36.Sh SYNOPSIS 37.Fd #include <sys/param.h> 38.Fd #include <sys/vnode.h> 39.Ft int 40.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" \ 41 "struct proc *p" "int slpflag" "int slptimeo" 42.Sh DESCRIPTION 43The 44.Fn vinvalbuf 45function invalidates all of the buffers associated with the given vnode. 46This includes buffers on the clean list and the dirty list. 47If the 48.Dv V_SAVE 49flag is specified then the buffers on the dirty list are synced prior to being 50released. 51If the 52.Dv V_SAVEMETA 53flag is set, indirect blocks will not be flushed. 54.Pp 55Its arguments are: 56.Bl -tag -width ".Fa slptimeo" 57.It Fa vp 58A pointer to the vnode whose buffers will be invalidated. 59.It Fa flags 60The supported flags are 61.Dv V_SAVE 62and 63.Dv V_SAVEMETA . 64.Dv V_SAVE 65indicates that dirty buffers should be synced with the disk. 66.Dv V_SAVEMETA 67indicates that indirect blocks should not be flushed. 68.It Fa cred 69The user credentials that are used to 70.Xr VOP_FSYNC 9 71buffers if 72.Dv V_SAVE 73is set. 74.It Fa p 75The process responsible for this call. 76.It Fa slpflag 77The slp flag that will be used in the priority of any sleeps in the function. 78.It Fa slptimeo 79The timeout for any sleeps in the function. 80.El 81.Sh LOCKS 82The vnode is assumed to be locked prior to the call and remains locked upon 83return. 84.Sh RETURN VALUES 85A value of 0 is returned on success. 86.Sh PSEUDOCODE 87.Bd -literal -offset indent 88vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); 89error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0); 90VOP_UNLOCK(devvp, 0, p); 91if (error) 92 return (error); 93.Ed 94.Sh ERRORS 95.Bl -tag -width Er 96.It Bq Er ENOSPC 97The file system is full. 98(With 99.Dv V_SAVE ) 100.It Bq Er EDQUOT 101Disc quota exceeded. 102(With 103.Dv V_SAVE ) 104.It Bq Er EWOULDBLOCK 105Sleep operation timed out. 106(See 107.Fa slptimeo ) 108.It Bq Er ERESTART 109A signal needs to be delivered and the system call should be restarted. 110(With 111.Dv PCATCH 112set in 113.Fa slpflag ) 114.It Bq Er EINTR 115The system has been interrupted by a signal. 116(With 117.Dv PCATCH 118set in 119.Fa slpflag ) 120.El 121.Sh SEE ALSO 122.Xr tsleep 9 , 123.Xr vnode 9 124.Sh AUTHORS 125This man page was originally written by 126.An Chad David Aq davidc@acns.ab.ca 127for 128.Fx . 129