1: /*
   2:  * Each buffer in the pool is usually doubly linked into 2 lists:
   3:  * the device with which it is currently associated (always)
   4:  * and also on a list of blocks available for allocation
   5:  * for other use (usually).
   6:  * The latter list is kept in last-used order, and the two
   7:  * lists are doubly linked to make it easy to remove
   8:  * a buffer from one list when it was found by
   9:  * looking through the other.
  10:  * A buffer is on the available list, and is liable
  11:  * to be reassigned to another disk block, if and only
  12:  * if it is not marked BUSY.  When a buffer is busy, the
  13:  * available-list pointers can be used for other purposes.
  14:  * Most drivers use the forward ptr as a link in their I/O
  15:  * active queue.
  16:  * A buffer header contains all the information required
  17:  * to perform I/O.
  18:  * Most of the routines which manipulate these things
  19:  * are in bio.c.
  20:  */
  21: struct buf
  22: {
  23:     short   b_flags;        /* see defines below */
  24:     struct  buf *b_forw;        /* headed by d_tab of conf.c */
  25:     struct  buf *b_back;        /*  "  */
  26:     struct  buf *av_forw;       /* position on free list, */
  27:     struct  buf *av_back;       /*     if not BUSY*/
  28:     dev_t   b_dev;          /* major+minor device name */
  29:     u_short b_bcount;       /* transfer count */
  30:     union   {
  31:         caddr_t b_addr;     /* low order core address */
  32:         short   *b_words;   /* words for clearing */
  33:         struct  filsys  *b_filsys;  /* superblocks */
  34:         struct  dinode  *b_dino;/* ilist */
  35:         daddr_t *b_daddr;   /* indirect block */
  36:     } b_un;
  37:     daddr_t b_blkno;        /* block # on device */
  38:     char    b_xmem;         /* high order core address */
  39:     char    b_error;        /* returned after I/O */
  40: #ifdef  UCB_BHASH
  41:     struct  buf *b_link;        /* hash links for buffer cache */
  42: #endif
  43:     u_short b_resid;        /* words not transferred after error */
  44: };
  45: 
  46: #ifdef  KERNEL
  47: extern  struct  buf buf[];      /* The buffer pool itself */
  48: extern  struct  buf bfreelist;      /* head of available list */
  49: #endif
  50: 
  51: /*
  52:  * These flags are kept in b_flags.
  53:  */
  54: #define B_WRITE     0000000 /* non-read pseudo-flag */
  55: #define B_READ      0000001 /* read when I/O occurs */
  56: #define B_DONE      0000002 /* transaction finished */
  57: #define B_ERROR     0000004 /* transaction aborted */
  58: #define B_BUSY      0000010 /* not on av_forw/back list */
  59: #define B_PHYS      0000020 /* Physical IO potentially using UNIBUS map */
  60: #define B_MAP       0000040 /* This block has the UNIBUS map allocated */
  61: #define B_WANTED    0000100 /* issue wakeup when BUSY goes off */
  62: #define B_AGE       0000200 /* place at head of free list when freed */
  63: #define B_ASYNC     0000400 /* don't wait for I/O completion */
  64: #define B_DELWRI    0001000 /* don't write till block leaves free list */
  65: #define B_TAPE      0002000 /* this is a magtape (no bdwrite) */
  66: #define B_RH70      0004000 /* this device is talking to an RH70 */
  67: #define B_UBAREMAP  0010000 /* buf's addr is UNIBUS virtual, not physical */
  68: #define B_BAD       0020000 /* diverted to replacement for bad sector */
  69: 
  70: /*
  71:  * special redeclarations for
  72:  * the head of the queue per
  73:  * device driver.
  74:  */
  75: #define b_actf      av_forw
  76: #define b_actl      av_back
  77: #define b_active    b_bcount
  78: #define b_errcnt    b_resid
  79: 
  80: /*
  81:  * redeclaration used by disksort()
  82:  */
  83: #define b_cylin     b_resid
  84: 
  85: /* arguments to chkphys */
  86: #define WORD    2       /* doing I/O by word */
  87: #define BYTE    1       /* doing I/O by byte */

Defined struct's

buf defined in line 21; used 698 times

Defined macros

BYTE defined in line 87; used 2 times
B_AGE defined in line 62; used 9 times
B_ASYNC defined in line 63; used 7 times
B_DELWRI defined in line 64; used 8 times
B_READ defined in line 55; used 119 times
B_TAPE defined in line 65; used 4 times
WORD defined in line 86; used 2 times
b_actf defined in line 75; used 175 times
b_active defined in line 77; used 165 times

Usage of this include

buf.h used 56 times
Last modified: 1983-09-05
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1037
Valid CSS Valid XHTML 1.0 Strict