BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / kern / vfs_bio.c
CommitLineData
da7c5cc6 1/*
7188ac27
KM
2 * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
3 * All rights reserved.
da7c5cc6 4 *
af359dea
C
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, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
7188ac27 20 *
af359dea
C
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * from: @(#)vfs_bio.c 7.40 (Berkeley) 5/8/91
da7c5cc6 34 */
961945a8 35
94368568 36#include "param.h"
3789a403 37#include "proc.h"
94368568 38#include "buf.h"
7188ac27 39#include "vnode.h"
0f93ba7b 40#include "specdev.h"
edadbc2c 41#include "mount.h"
94368568 42#include "trace.h"
f28ea80c 43#include "resourcevar.h"
663dbc72 44
af359dea
C
45/*
46 * Initialize buffers and hash links for buffers.
47 */
48bufinit()
49{
50
51 /*
52 * Body deleted.
53 */
54 return;
55}
663dbc72 56
663dbc72 57/*
d42a4811
KM
58 * Find the block in the buffer pool.
59 * If the buffer is not present, allocate a new buffer and load
60 * its contents according to the filesystem fill routine.
663dbc72 61 */
a937f856 62bread(vp, blkno, size, cred, bpp)
7188ac27 63 struct vnode *vp;
ad30fb67
KM
64 daddr_t blkno;
65 int size;
a937f856 66 struct ucred *cred;
7188ac27 67 struct buf **bpp;
663dbc72 68{
663dbc72 69
af359dea
C
70 /*
71 * Body deleted.
72 */
73 return (EIO);
663dbc72
BJ
74}
75
76/*
d42a4811
KM
77 * Operates like bread, but also starts I/O on the specified
78 * read-ahead block.
663dbc72 79 */
a937f856 80breada(vp, blkno, size, rablkno, rabsize, cred, bpp)
7188ac27 81 struct vnode *vp;
84baaab3 82 daddr_t blkno; int size;
a8d3bf7f 83 daddr_t rablkno; int rabsize;
a937f856 84 struct ucred *cred;
7188ac27 85 struct buf **bpp;
663dbc72 86{
3efdd860
KM
87
88 /*
af359dea 89 * Body deleted.
3efdd860 90 */
af359dea 91 return (EIO);
663dbc72
BJ
92}
93
94/*
d42a4811
KM
95 * Synchronous write.
96 * Release buffer on completion.
663dbc72
BJ
97 */
98bwrite(bp)
3efdd860 99 register struct buf *bp;
663dbc72 100{
3efdd860
KM
101
102 /*
af359dea 103 * Body deleted.
3efdd860 104 */
af359dea 105 return (EIO);
663dbc72
BJ
106}
107
108/*
d42a4811
KM
109 * Delayed write.
110 *
111 * The buffer is marked dirty, but is not queued for I/O.
112 * This routine should be used when the buffer is expected
113 * to be modified again soon, typically a small write that
114 * partially fills a buffer.
115 *
116 * NB: magnetic tapes cannot be delayed; they must be
117 * written in the order that the writes are requested.
663dbc72
BJ
118 */
119bdwrite(bp)
3efdd860 120 register struct buf *bp;
663dbc72 121{
663dbc72 122
7188ac27 123 /*
af359dea 124 * Body deleted.
7188ac27 125 */
af359dea 126 return;
663dbc72
BJ
127}
128
129/*
d42a4811
KM
130 * Asynchronous write.
131 * Start I/O on a buffer, but do not wait for it to complete.
132 * The buffer is released when the I/O completes.
663dbc72
BJ
133 */
134bawrite(bp)
3efdd860 135 register struct buf *bp;
663dbc72
BJ
136{
137
d42a4811 138 /*
af359dea 139 * Body deleted.
d42a4811 140 */
af359dea 141 return;
663dbc72
BJ
142}
143
144/*
d42a4811
KM
145 * Release a buffer.
146 * Even if the buffer is dirty, no I/O is started.
663dbc72
BJ
147 */
148brelse(bp)
3efdd860 149 register struct buf *bp;
663dbc72 150{
edadbc2c
KM
151
152 /*
af359dea 153 * Body deleted.
edadbc2c 154 */
af359dea 155 return;
663dbc72
BJ
156}
157
158/*
d42a4811 159 * Check to see if a block is currently memory resident.
663dbc72 160 */
7188ac27
KM
161incore(vp, blkno)
162 struct vnode *vp;
3efdd860 163 daddr_t blkno;
663dbc72 164{
663dbc72 165
af359dea
C
166 /*
167 * Body deleted.
168 */
663dbc72
BJ
169 return (0);
170}
171
172/*
d42a4811
KM
173 * Check to see if a block is currently memory resident.
174 * If it is resident, return it. If it is not resident,
175 * allocate a new buffer and assign it to the block.
663dbc72
BJ
176 */
177struct buf *
7188ac27
KM
178getblk(vp, blkno, size)
179 register struct vnode *vp;
ad30fb67
KM
180 daddr_t blkno;
181 int size;
663dbc72 182{
663dbc72 183
3efdd860 184 /*
af359dea 185 * Body deleted.
3efdd860 186 */
af359dea 187 return (0);
663dbc72
BJ
188}
189
190/*
d42a4811
KM
191 * Allocate a buffer.
192 * The caller will assign it to a block.
663dbc72
BJ
193 */
194struct buf *
ad30fb67
KM
195geteblk(size)
196 int size;
663dbc72 197{
663dbc72 198
af359dea
C
199 /*
200 * Body deleted.
201 */
202 return (0);
663dbc72
BJ
203}
204
ad30fb67 205/*
521a4688 206 * Expand or contract the actual memory allocated to a buffer.
d42a4811 207 * If no memory is available, release buffer and take error exit.
ad30fb67 208 */
521a4688
KM
209allocbuf(tp, size)
210 register struct buf *tp;
ad30fb67
KM
211 int size;
212{
ad30fb67 213
521a4688 214 /*
af359dea 215 * Body deleted.
521a4688 216 */
af359dea 217 return (0);
4f083fd7
SL
218}
219
4f083fd7
SL
220/*
221 * Find a buffer which is available for use.
222 * Select something from a free list.
223 * Preference is to AGE list, then LRU list.
224 */
225struct buf *
226getnewbuf()
227{
4f083fd7 228
af359dea
C
229 /*
230 * Body deleted.
231 */
232 return (0);
4f083fd7
SL
233}
234
663dbc72 235/*
d42a4811
KM
236 * Wait for I/O to complete.
237 *
238 * Extract and return any errors associated with the I/O.
239 * If the error flag is set, but no specific error is
240 * given, return EIO.
663dbc72 241 */
3efdd860 242biowait(bp)
ad30fb67 243 register struct buf *bp;
663dbc72
BJ
244{
245
7188ac27 246 /*
af359dea 247 * Body deleted.
7188ac27 248 */
7188ac27 249 return (EIO);
663dbc72
BJ
250}
251
663dbc72 252/*
af04ce66 253 * Mark I/O complete on a buffer.
7b8b5a01 254 *
d42a4811
KM
255 * If a callback has been requested, e.g. the pageout
256 * daemon, do so. Otherwise, awaken waiting processes.
7b8b5a01 257 */
3efdd860 258biodone(bp)
edadbc2c 259 register struct buf *bp;
edadbc2c 260{
edadbc2c 261
edadbc2c 262 /*
af359dea 263 * Body deleted.
edadbc2c 264 */
af359dea 265 return;
edadbc2c 266}