xref: /csrg-svn/sys/kern/PROTO/44Lite/vfs_bio.c (revision 49678)
1*49678Smckusick /*
2*49678Smckusick  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
3*49678Smckusick  * All rights reserved.
4*49678Smckusick  *
5*49678Smckusick  * %sccs.include.redist.c%
6*49678Smckusick  *
7*49678Smckusick  *	from: @(#)vfs_bio.c	7.40 (Berkeley) 5/8/91
8*49678Smckusick  */
9*49678Smckusick 
10*49678Smckusick #include "param.h"
11*49678Smckusick #include "proc.h"
12*49678Smckusick #include "buf.h"
13*49678Smckusick #include "vnode.h"
14*49678Smckusick #include "specdev.h"
15*49678Smckusick #include "mount.h"
16*49678Smckusick #include "trace.h"
17*49678Smckusick #include "resourcevar.h"
18*49678Smckusick 
19*49678Smckusick /*
20*49678Smckusick  * Initialize buffers and hash links for buffers.
21*49678Smckusick  */
22*49678Smckusick bufinit()
23*49678Smckusick {
24*49678Smckusick 
25*49678Smckusick 	/*
26*49678Smckusick 	 * Body deleted.
27*49678Smckusick 	 */
28*49678Smckusick 	return;
29*49678Smckusick }
30*49678Smckusick 
31*49678Smckusick /*
32*49678Smckusick  * Find the block in the buffer pool.
33*49678Smckusick  * If the buffer is not present, allocate a new buffer and load
34*49678Smckusick  * its contents according to the filesystem fill routine.
35*49678Smckusick  */
36*49678Smckusick bread(vp, blkno, size, cred, bpp)
37*49678Smckusick 	struct vnode *vp;
38*49678Smckusick 	daddr_t blkno;
39*49678Smckusick 	int size;
40*49678Smckusick 	struct ucred *cred;
41*49678Smckusick 	struct buf **bpp;
42*49678Smckusick {
43*49678Smckusick 
44*49678Smckusick 	/*
45*49678Smckusick 	 * Body deleted.
46*49678Smckusick 	 */
47*49678Smckusick 	return (EIO);
48*49678Smckusick }
49*49678Smckusick 
50*49678Smckusick /*
51*49678Smckusick  * Operates like bread, but also starts I/O on the specified
52*49678Smckusick  * read-ahead block.
53*49678Smckusick  */
54*49678Smckusick breada(vp, blkno, size, rablkno, rabsize, cred, bpp)
55*49678Smckusick 	struct vnode *vp;
56*49678Smckusick 	daddr_t blkno; int size;
57*49678Smckusick 	daddr_t rablkno; int rabsize;
58*49678Smckusick 	struct ucred *cred;
59*49678Smckusick 	struct buf **bpp;
60*49678Smckusick {
61*49678Smckusick 
62*49678Smckusick 	/*
63*49678Smckusick 	 * Body deleted.
64*49678Smckusick 	 */
65*49678Smckusick 	return (EIO);
66*49678Smckusick }
67*49678Smckusick 
68*49678Smckusick /*
69*49678Smckusick  * Synchronous write.
70*49678Smckusick  * Release buffer on completion.
71*49678Smckusick  */
72*49678Smckusick bwrite(bp)
73*49678Smckusick 	register struct buf *bp;
74*49678Smckusick {
75*49678Smckusick 
76*49678Smckusick 	/*
77*49678Smckusick 	 * Body deleted.
78*49678Smckusick 	 */
79*49678Smckusick 	return (EIO);
80*49678Smckusick }
81*49678Smckusick 
82*49678Smckusick /*
83*49678Smckusick  * Delayed write.
84*49678Smckusick  *
85*49678Smckusick  * The buffer is marked dirty, but is not queued for I/O.
86*49678Smckusick  * This routine should be used when the buffer is expected
87*49678Smckusick  * to be modified again soon, typically a small write that
88*49678Smckusick  * partially fills a buffer.
89*49678Smckusick  *
90*49678Smckusick  * NB: magnetic tapes cannot be delayed; they must be
91*49678Smckusick  * written in the order that the writes are requested.
92*49678Smckusick  */
93*49678Smckusick bdwrite(bp)
94*49678Smckusick 	register struct buf *bp;
95*49678Smckusick {
96*49678Smckusick 
97*49678Smckusick 	/*
98*49678Smckusick 	 * Body deleted.
99*49678Smckusick 	 */
100*49678Smckusick 	return;
101*49678Smckusick }
102*49678Smckusick 
103*49678Smckusick /*
104*49678Smckusick  * Asynchronous write.
105*49678Smckusick  * Start I/O on a buffer, but do not wait for it to complete.
106*49678Smckusick  * The buffer is released when the I/O completes.
107*49678Smckusick  */
108*49678Smckusick bawrite(bp)
109*49678Smckusick 	register struct buf *bp;
110*49678Smckusick {
111*49678Smckusick 
112*49678Smckusick 	/*
113*49678Smckusick 	 * Body deleted.
114*49678Smckusick 	 */
115*49678Smckusick 	return;
116*49678Smckusick }
117*49678Smckusick 
118*49678Smckusick /*
119*49678Smckusick  * Release a buffer.
120*49678Smckusick  * Even if the buffer is dirty, no I/O is started.
121*49678Smckusick  */
122*49678Smckusick brelse(bp)
123*49678Smckusick 	register struct buf *bp;
124*49678Smckusick {
125*49678Smckusick 
126*49678Smckusick 	/*
127*49678Smckusick 	 * Body deleted.
128*49678Smckusick 	 */
129*49678Smckusick 	return;
130*49678Smckusick }
131*49678Smckusick 
132*49678Smckusick /*
133*49678Smckusick  * Check to see if a block is currently memory resident.
134*49678Smckusick  */
135*49678Smckusick incore(vp, blkno)
136*49678Smckusick 	struct vnode *vp;
137*49678Smckusick 	daddr_t blkno;
138*49678Smckusick {
139*49678Smckusick 
140*49678Smckusick 	/*
141*49678Smckusick 	 * Body deleted.
142*49678Smckusick 	 */
143*49678Smckusick 	return (0);
144*49678Smckusick }
145*49678Smckusick 
146*49678Smckusick /*
147*49678Smckusick  * Check to see if a block is currently memory resident.
148*49678Smckusick  * If it is resident, return it. If it is not resident,
149*49678Smckusick  * allocate a new buffer and assign it to the block.
150*49678Smckusick  */
151*49678Smckusick struct buf *
152*49678Smckusick getblk(vp, blkno, size)
153*49678Smckusick 	register struct vnode *vp;
154*49678Smckusick 	daddr_t blkno;
155*49678Smckusick 	int size;
156*49678Smckusick {
157*49678Smckusick 
158*49678Smckusick 	/*
159*49678Smckusick 	 * Body deleted.
160*49678Smckusick 	 */
161*49678Smckusick 	return (0);
162*49678Smckusick }
163*49678Smckusick 
164*49678Smckusick /*
165*49678Smckusick  * Allocate a buffer.
166*49678Smckusick  * The caller will assign it to a block.
167*49678Smckusick  */
168*49678Smckusick struct buf *
169*49678Smckusick geteblk(size)
170*49678Smckusick 	int size;
171*49678Smckusick {
172*49678Smckusick 
173*49678Smckusick 	/*
174*49678Smckusick 	 * Body deleted.
175*49678Smckusick 	 */
176*49678Smckusick 	return (0);
177*49678Smckusick }
178*49678Smckusick 
179*49678Smckusick /*
180*49678Smckusick  * Expand or contract the actual memory allocated to a buffer.
181*49678Smckusick  * If no memory is available, release buffer and take error exit.
182*49678Smckusick  */
183*49678Smckusick allocbuf(tp, size)
184*49678Smckusick 	register struct buf *tp;
185*49678Smckusick 	int size;
186*49678Smckusick {
187*49678Smckusick 
188*49678Smckusick 	/*
189*49678Smckusick 	 * Body deleted.
190*49678Smckusick 	 */
191*49678Smckusick 	return (0);
192*49678Smckusick }
193*49678Smckusick 
194*49678Smckusick /*
195*49678Smckusick  * Find a buffer which is available for use.
196*49678Smckusick  * Select something from a free list.
197*49678Smckusick  * Preference is to AGE list, then LRU list.
198*49678Smckusick  */
199*49678Smckusick struct buf *
200*49678Smckusick getnewbuf()
201*49678Smckusick {
202*49678Smckusick 
203*49678Smckusick 	/*
204*49678Smckusick 	 * Body deleted.
205*49678Smckusick 	 */
206*49678Smckusick 	return (0);
207*49678Smckusick }
208*49678Smckusick 
209*49678Smckusick /*
210*49678Smckusick  * Wait for I/O to complete.
211*49678Smckusick  *
212*49678Smckusick  * Extract and return any errors associated with the I/O.
213*49678Smckusick  * If the error flag is set, but no specific error is
214*49678Smckusick  * given, return EIO.
215*49678Smckusick  */
216*49678Smckusick biowait(bp)
217*49678Smckusick 	register struct buf *bp;
218*49678Smckusick {
219*49678Smckusick 
220*49678Smckusick 	/*
221*49678Smckusick 	 * Body deleted.
222*49678Smckusick 	 */
223*49678Smckusick 	return (EIO);
224*49678Smckusick }
225*49678Smckusick 
226*49678Smckusick /*
227*49678Smckusick  * Mark I/O complete on a buffer.
228*49678Smckusick  *
229*49678Smckusick  * If a callback has been requested, e.g. the pageout
230*49678Smckusick  * daemon, do so. Otherwise, awaken waiting processes.
231*49678Smckusick  */
232*49678Smckusick biodone(bp)
233*49678Smckusick 	register struct buf *bp;
234*49678Smckusick {
235*49678Smckusick 
236*49678Smckusick 	/*
237*49678Smckusick 	 * Body deleted.
238*49678Smckusick 	 */
239*49678Smckusick 	 return;
240*49678Smckusick }
241