home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / kern / vfs_bio.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-11  |  5.2 KB  |  267 lines

  1. /*
  2.  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
  3.  * 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, 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.
  20.  *
  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
  34.  */
  35.  
  36. #include "param.h"
  37. #include "proc.h"
  38. #include "buf.h"
  39. #include "vnode.h"
  40. #include "specdev.h"
  41. #include "mount.h"
  42. #include "trace.h"
  43. #include "resourcevar.h"
  44.  
  45. /*
  46.  * Initialize buffers and hash links for buffers.
  47.  */
  48. bufinit()
  49. {
  50.  
  51.     /*
  52.      * Body deleted.
  53.      */
  54.     return;
  55. }
  56.  
  57. /*
  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.
  61.  */
  62. bread(vp, blkno, size, cred, bpp)
  63.     struct vnode *vp;
  64.     daddr_t blkno;
  65.     int size;
  66.     struct ucred *cred;
  67.     struct buf **bpp;
  68. {
  69.  
  70.     /*
  71.      * Body deleted.
  72.      */
  73.     return (EIO);
  74. }
  75.  
  76. /*
  77.  * Operates like bread, but also starts I/O on the specified
  78.  * read-ahead block.
  79.  */
  80. breada(vp, blkno, size, rablkno, rabsize, cred, bpp)
  81.     struct vnode *vp;
  82.     daddr_t blkno; int size;
  83.     daddr_t rablkno; int rabsize;
  84.     struct ucred *cred;
  85.     struct buf **bpp;
  86. {
  87.  
  88.     /*
  89.      * Body deleted.
  90.      */
  91.     return (EIO);
  92. }
  93.  
  94. /*
  95.  * Synchronous write.
  96.  * Release buffer on completion.
  97.  */
  98. bwrite(bp)
  99.     register struct buf *bp;
  100. {
  101.  
  102.     /*
  103.      * Body deleted.
  104.      */
  105.     return (EIO);
  106. }
  107.  
  108. /*
  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.
  118.  */
  119. bdwrite(bp)
  120.     register struct buf *bp;
  121. {
  122.  
  123.     /*
  124.      * Body deleted.
  125.      */
  126.     return;
  127. }
  128.  
  129. /*
  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.
  133.  */
  134. bawrite(bp)
  135.     register struct buf *bp;
  136. {
  137.  
  138.     /*
  139.      * Body deleted.
  140.      */
  141.     return;
  142. }
  143.  
  144. /*
  145.  * Release a buffer.
  146.  * Even if the buffer is dirty, no I/O is started.
  147.  */
  148. brelse(bp)
  149.     register struct buf *bp;
  150. {
  151.  
  152.     /*
  153.      * Body deleted.
  154.      */
  155.     return;
  156. }
  157.  
  158. /*
  159.  * Check to see if a block is currently memory resident.
  160.  */
  161. incore(vp, blkno)
  162.     struct vnode *vp;
  163.     daddr_t blkno;
  164. {
  165.  
  166.     /*
  167.      * Body deleted.
  168.      */
  169.     return (0);
  170. }
  171.  
  172. /*
  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.
  176.  */
  177. struct buf *
  178. getblk(vp, blkno, size)
  179.     register struct vnode *vp;
  180.     daddr_t blkno;
  181.     int size;
  182. {
  183.  
  184.     /*
  185.      * Body deleted.
  186.      */
  187.     return (0);
  188. }
  189.  
  190. /*
  191.  * Allocate a buffer.
  192.  * The caller will assign it to a block.
  193.  */
  194. struct buf *
  195. geteblk(size)
  196.     int size;
  197. {
  198.  
  199.     /*
  200.      * Body deleted.
  201.      */
  202.     return (0);
  203. }
  204.  
  205. /*
  206.  * Expand or contract the actual memory allocated to a buffer.
  207.  * If no memory is available, release buffer and take error exit.
  208.  */
  209. allocbuf(tp, size)
  210.     register struct buf *tp;
  211.     int size;
  212. {
  213.  
  214.     /*
  215.      * Body deleted.
  216.      */
  217.     return (0);
  218. }
  219.  
  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.  */
  225. struct buf *
  226. getnewbuf()
  227. {
  228.  
  229.     /*
  230.      * Body deleted.
  231.      */
  232.     return (0);
  233. }
  234.  
  235. /*
  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.
  241.  */
  242. biowait(bp)
  243.     register struct buf *bp;
  244. {
  245.  
  246.     /*
  247.      * Body deleted.
  248.      */
  249.     return (EIO);
  250. }
  251.  
  252. /*
  253.  * Mark I/O complete on a buffer.
  254.  *
  255.  * If a callback has been requested, e.g. the pageout
  256.  * daemon, do so. Otherwise, awaken waiting processes.
  257.  */
  258. biodone(bp)
  259.     register struct buf *bp;
  260. {
  261.  
  262.     /*
  263.      * Body deleted.
  264.      */
  265.      return;
  266. }
  267.