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:     int 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:     unsigned b_bcount;      /* transfer count */
  30:     union {
  31:         caddr_t b_addr;     /* low order core address */
  32:         int *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:     unsigned int b_resid;       /* words not transferred after error */
  41: };
  42: 
  43: extern struct buf buf[];        /* The buffer pool itself */
  44: extern struct buf bfreelist;        /* head of available list */
  45: 
  46: /*
  47:  * These flags are kept in b_flags.
  48:  */
  49: #define B_WRITE 0   /* non-read pseudo-flag */
  50: #define B_READ  01  /* read when I/O occurs */
  51: #define B_DONE  02  /* transaction finished */
  52: #define B_ERROR 04  /* transaction aborted */
  53: #define B_BUSY  010 /* not on av_forw/back list */
  54: #define B_PHYS  020 /* Physical IO potentially using UNIBUS map */
  55: #define B_MAP   040 /* This block has the UNIBUS map allocated */
  56: #define B_WANTED 0100   /* issue wakeup when BUSY goes off */
  57: #define B_AGE   0200    /* delayed write for correct aging */
  58: #define B_ASYNC 0400    /* don't wait for I/O completion */
  59: #define B_DELWRI 01000  /* don't write till block leaves available list */
  60: #define B_TAPE 02000    /* this is a magtape (no bdwrite) */
  61: #define B_PBUSY 04000
  62: #define B_PACK  010000
  63: 
  64: /*
  65:  * special redeclarations for
  66:  * the head of the queue per
  67:  * device driver.
  68:  */
  69: #define b_actf  av_forw
  70: #define b_actl  av_back
  71: #define b_active b_bcount
  72: #define b_errcnt b_resid

Defined struct's

buf defined in line 21; used 236 times

Defined macros

B_AGE defined in line 57; used 4 times
B_ASYNC defined in line 58; used 8 times
B_BUSY defined in line 53; used 19 times
B_DELWRI defined in line 59; used 6 times
B_DONE defined in line 51; used 9 times
B_MAP defined in line 55; used 3 times
B_PACK defined in line 62; used 1 times
B_PBUSY defined in line 61; used 2 times
B_PHYS defined in line 54; used 7 times
B_TAPE defined in line 60; used 3 times
B_WANTED defined in line 56; used 21 times
b_actf defined in line 69; used 52 times
b_active defined in line 71; used 52 times
b_actl defined in line 70; used 20 times
b_errcnt defined in line 72; used 28 times

Usage of this include

Last modified: 1979-05-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 805
Valid CSS Valid XHTML 1.0 Strict