vinvalbuf.9 (0ef36920de3bcc0f8591af5fcc9157be26dcb38a) vinvalbuf.9 (237890249500ead0799bc56cdcb861e3faec8f18)
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 17 unchanged lines hidden (view full) ---

26.\"
27.\" $FreeBSD$
28.\"
29.Dd July 7, 2001
30.Dt VINVALBUF 9
31.Os
32.Sh NAME
33.Nm vinvalbuf
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice(s), this list of conditions and the following disclaimer as

--- 17 unchanged lines hidden (view full) ---

26.\"
27.\" $FreeBSD$
28.\"
29.Dd July 7, 2001
30.Dt VINVALBUF 9
31.Os
32.Sh NAME
33.Nm vinvalbuf
34.Nd "Flushes and invalidates all buffers associated with a vnode"
34.Nd "flushes and invalidates all buffers associated with a vnode"
35.Sh SYNOPSIS
35.Sh SYNOPSIS
36.Fd #include <sys/param.h>
37.Fd #include <sys/vnode.h>
36.In sys/param.h
37.In sys/vnode.h
38.Ft int
39.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" "struct proc *p" "int slpflag" "int slptimeo"
40.Sh DESCRIPTION
41The
38.Ft int
39.Fn vinvalbuf "struct vnode *vp" "int flags" "struct ucred *cred" "struct proc *p" "int slpflag" "int slptimeo"
40.Sh DESCRIPTION
41The
42.Nm
42.Fn vinvalbuf
43function invalidates all of the buffers associated with the given vnode.
43function invalidates all of the buffers associated with the given vnode.
44This includes buffers on the clean list and the dirty list. If the V_SAVE
44This includes buffers on the clean list and the dirty list.
45If the
46.Dv V_SAVE
45flag is specified then the buffers on the dirty list are synced prior to being
47flag is specified then the buffers on the dirty list are synced prior to being
46released. If there is a VM Object associated with the vnode it is removed.
48released.
49If there is a VM Object associated with the vnode, it is removed.
47.Pp
48Its arguments are:
50.Pp
51Its arguments are:
49.Bl -tag -width spltimeo
50.It Ar vp
52.Bl -tag -xwidth ".Fa spltimeo"
53.It Fa vp
51A pointer to the vnode whose buffers will be invalidated.
54A pointer to the vnode whose buffers will be invalidated.
52.It Ar flags
53The only supported flag is V_SAVE and it indicates that dirty buffers should by synced.
54.It Ar cred
55.It Fa flags
56The only supported flag is
57.Dv V_SAVE
58and it indicates that dirty buffers should by synced.
59.It Fa cred
55The user credentials that are used to
60The user credentials that are used to
56.Fn VOP_FSYNC ""
57buffers if V_SAVE is set.
58.It Ar p
61.Xr VOP_FSYNC 9
62buffers if
63.Dv V_SAVE
64is set.
65.It Fa p
59The process responsible for this call.
66The process responsible for this call.
60.It Ar slpflag
67.It Fa slpflag
61The slp flag that will be used in the priority of any sleeps in the function.
68The slp flag that will be used in the priority of any sleeps in the function.
62.It Ar slptimeo
69.It Fa slptimeo
63The timeout for any sleeps in the function.
64.El
65.Sh LOCKS
66The vnode is assumed to be locked prior to the call and remains locked upon return.
67.Pp
68Giant must be held by prior to the call and remains locked upon return.
69.Sh RETURN VALUES
70The timeout for any sleeps in the function.
71.El
72.Sh LOCKS
73The vnode is assumed to be locked prior to the call and remains locked upon return.
74.Pp
75Giant must be held by prior to the call and remains locked upon return.
76.Sh RETURN VALUES
70A 0 value is returned on success.
77A 0 value is returned on success.
71.Sh PSEUDOCODE
78.Sh PSEUDOCODE
72.Bd -literal
73 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
74 error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0);
75 VOP_UNLOCK(devvp, 0, p);
76 if (error)
77 return (error);
79.Bd -literal -offset indent
80vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
81error = vinvalbuf(devvp, V_SAVE, cred, p, 0, 0);
82VOP_UNLOCK(devvp, 0, p);
83if (error)
84 return (error);
78.Ed
79.Sh ERRORS
80.Bl -tag -width Er
81.It Bq Er ENOSPC
85.Ed
86.Sh ERRORS
87.Bl -tag -width Er
88.It Bq Er ENOSPC
82The filesystem is full. (With V_SAVE)
89The filesystem is full.
90(With
91.Dv V_SAVE )
83.It Bq Er EDQUOT
92.It Bq Er EDQUOT
84Disc quota exceeded. (With V_SAVE)
93Disc quota exceeded.
94(With
95.Dv V_SAVE )
85.It Bq Er EWOULDBLOCK
96.It Bq Er EWOULDBLOCK
86Sleep operation timed out (See slptimeo)
97Sleep operation timed out.
98(See
99.Fa slptimeo )
87.It Bq Er ERESTART
100.It Bq Er ERESTART
88A signal needs to be delivered and the system call should be restarted (With PCATCH set in slpflag)
101A signal needs to be delivered and the system call should be restarted.
102(With
103.Dv PCATCH
104set in
105.Fa slpflag )
89.It Bq Er EINTR
106.It Bq Er EINTR
90The system has been interrupted by a signal (With PCATCH set in slpflag)
107The system has been interrupted by a signal.
108(With
109.Dv PCATCH
110set in
111.Fa slpflag )
91.El
92.Sh SEE ALSO
112.El
113.Sh SEE ALSO
93.Xr brelse 9
94.Xr bremfree 9
114.Xr brelse 9 ,
115.Xr bremfree 9 ,
116.Xr tsleep 9 ,
95.Xr VOP_FSYNC 9
117.Xr VOP_FSYNC 9
96.Xr tsleep 9
97.Sh AUTHORS
118.Sh AUTHORS
98This man page was written by Chad David.
119This man page was written by
120.An Chad David .