h/buf.h

05400 /* 05401 * Each buffer in the pool is usually doubly linked into 2 lists: 05402 * the device with which it is currently associated (always) 05403 * and also on a list of blocks available for allocation 05404 * for other use (usually). 05405 * The latter list is kept in last-used order, and the two 05406 * lists are doubly linked to make it easy to remove 05407 * a buffer from one list when it was found by 05408 * looking through the other. 05409 * A buffer is on the available list, and is liable 05410 * to be reassigned to another disk block, if and only 05411 * if it is not marked BUSY. When a buffer is busy, the 05412 * available-list pointers can be used for other purposes. 05413 * Most drivers use the forward ptr as a link in their I/O 05414 * active queue. 05415 * A buffer header contains all the information required 05416 * to perform I/O. 05417 * Most of the routines which manipulate these things 05418 * are in bio.c. 05419 */ 05420 struct buf 05421 { 05422 int b_flags; /* see defines below */ 05423 struct buf *b_forw; /* headed by d_tab of conf.c */ 05424 struct buf *b_back; /* " */ 05425 struct buf *av_forw; /* position on free list, */ 05426 struct buf *av_back; /* if not BUSY*/ 05427 dev_t b_dev; /* major+minor device name */ 05428 unsigned b_bcount; /* transfer count */ 05429 union { 05430 caddr_t b_addr; /* low order core address */ 05431 int *b_words; /* words for clearing */ 05432 struct filsys *b_filsys; /* superblocks */ 05433 struct dinode *b_dino; /* ilist */ 05434 daddr_t *b_daddr; /* indirect block */ 05435 } b_un; 05436 daddr_t b_blkno; /* block # on device */ 05437 char b_xmem; /* high order core address */ 05438 char b_error; /* returned after I/O */ 05439 unsigned int b_resid; /* words not transferred after error */ 05440 }; 05441 05442 extern struct buf buf[]; /* The buffer pool itself */ 05443 extern struct buf bfreelist; /* head of available list */ 05444 05445 /* 05446 * These flags are kept in b_flags. 05447 */ 05448 #define B_WRITE 0 /* non-read pseudo-flag */ 05449 #define B_READ 01 /* read when I/O occurs */ 05450 #define B_DONE 02 /* transaction finished */ 05451 #define B_ERROR 04 /* transaction aborted */ 05452 #define B_BUSY 010 /* not on av_forw/back list */ 05453 #define B_PHYS 020 /* Physical IO potentially using UNIBUS map */ 05454 #define B_MAP 040 /* This block has the UNIBUS map allocated */ 05455 #define B_WANTED 0100 /* issue wakeup when BUSY goes off */ 05456 #define B_AGE 0200 /* delayed write for correct aging */ 05457 #define B_ASYNC 0400 /* don't wait for I/O completion */ 05458 #define B_DELWRI 01000 /* don't write till block leaves available list */ 05459 #define B_TAPE 02000 /* this is a magtape (no bdwrite) */ 05460 #define B_PBUSY 04000 05461 #define B_PACK 010000 05462 05463 /* 05464 * special redeclarations for 05465 * the head of the queue per 05466 * device driver. 05467 */ 05468 #define b_actf av_forw 05469 #define b_actl av_back 05470 #define b_active b_bcount 05471 #define b_errcnt b_resid 05472 05473 05474 05475 05476 05477 05478 05479 05480 05481 05482 05483 05484 05485 05486 05487 05488 05489 05490 05491 05492 05493 05494 05495 05496 05497 05498 05499