home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#) devbuf.h 1.1 88/11/03
- *
- * Copyright (C) The Santa Cruz Operation, 1985, 1986, 1987, 1988.
- * This Module contains Proprietary Information of
- * The Santa Cruz Operation and should be treated as Confidential.
- *
- */
-
- /* devbuf - device buffer managment routines
- *
- * These routines provide large core memory buffers for tape drives
- * and other devices that need huge amounts of memory for buffers
- */
-
- #define MAXDBREQ 30 /* Max # of chunks in single devbuf request */
-
- struct devbuf {
- int bufptr; /* pointer to beginning of core block */
- int bufend; /* pointer to end of core block */
- int size; /* size of core buf in device blocks */
- int head; /* where to put data to the buffer */
- int tail; /* where to get data from the buffer */
- int sel; /* selector storage & in use flag */
- int ldbs; /* shift for MMU size <-> block size */
- int debug; /* debug flag */
- };
-
- /* ldbs (log of delta between block sizes) is used to shift left/right
- * when converting device block sizes to/from MMU page sizes
- */
-
- #define dstoms(x) ((x) >> dbptr->ldbs)
- #define mstods(x) ((x) << dbptr->ldbs)
-
- /* compute the amount of data in the buffer in device block units
- */
-
- #define db_amtdata(b) \
- ((b.head-b.tail)>=0 ? b.head-b.tail : b.size-(b.tail-b.head))
-
- /* compute the amount of free space in the buffer in device block units
- */
-
- #define db_amtfree(b) \
- ((b.head-b.tail)>=0 ? b.size-(b.head-b.tail)-1 : b.tail-b.head-1)
-
- /* increment the head/tail pointer
- */
-
- #define db_inc(b,p) \
- if (1) { \
- register int i; \
- i = b.p + 1 ; \
- if (i == b.bufend) i = b.bufptr; \
- b.p = i; \
- } else
-
-