; static char *SCCSID = "@(#)const.h    6.4 92/01/31";  
;  Constants for File System/
;*
;*      HISTORY
;*          8-Nov-1988 Thomas Fenwick [thomasf] pickup volume changes
;*          14-Sep-1988 11:41 by Leif Pederson [leifp] resynch w/Gordon
;  
;   Conditional compilation switches
;*
;*  DEBUG           enables full internal debugging and internal error checking
;*  DEBUG_HOLDS     enables internal debugging for INCR_HOLDS & DECR_HOLDS
;*  DEBUGHEAP       enables heap scrubbing/checking
;*  DEBUG_ASYNC     enables asynchronous I/O tracing (dprintfs)
;*  FIND_NOTIFY     enables find-notify support (turn on/off in notify.h to
;*                      save from recompiling the world)
;*  USE_DEVIOCTL    causes fs_fsctl to use fsh_devioctl rather than
;*                      fsh_dovolio2
;*  EAFIX           enables EA support
;*  TEFTI           produce version containing timing code
;*  BUFZAP          clears buffers on writes
;*  DISK_READ_TEST  scans disk for bad reads on mount
;*  RAHEAD_VARS     enables code which allows read ahead params to be
;*                      changed via fsctl entry points.
;*  RAHEAD          enables read ahead using auxiliary thread and causes
;*                      a buffer to be allocated
;*  STATIC          allows control over scope of captive functions and
;*                      variables
;  
;  for now, do hold count checking whenever DEBUG is turned on   
ifdef DEBUG
DEBUG_HOLDS	EQU	1

endif
; 
;* The normal minimum number of sectors that we pre-allocate when a
;* file grows as a result of writing.
;  
GROWDELT	EQU	16 
; 
;* The number of sectors that we pre-allocate when a file is created.
;  
PRIMARY_ALLOCATION	EQU	8    ;  primary space allocation (sectors)   
;  Sector sizes   
SECSIZE	EQU	512              ;  512 bytes per sector   
SECSHIFT	EQU	9                ;  2^9 = SECSIZE   
;  Cache Sizes   
SPB	EQU	4                ;  sectors per buffer   
SPB4	EQU	1

;  #define SPB8   
ifdef SPB4
SPBMASK	EQU	3                ;  mask for SPB   
SPBSHIFT	EQU	2 
SPBBITS	EQU	0fH             ;  SPB number of one bits, low order   
endif
ifdef SPB8
SPBMASK	EQU	7                ;  mask for SPB   
SPBSHIFT	EQU	3 
SPBBITS	EQU	0ffH             ;  SPB number of one bits, low order   
endif
PERCENT_CACHE	EQU	10               ;  percent of DosMemAvail used
;                                        * for cache   
MINBUF	EQU	(64 /(SPB/2 ))    ;  minimum of 64KByte cache   
BMASK	EQU	(SPB*SECSIZE-1 ) ;  mask offset in to cache block   
BSHIFT	EQU	(SECSHIFT+SPBSHIFT)
LWBUFCT	EQU	16               ;  size of lazy writer buffer   
LZ_RD_BIT_MAP_SIZE	EQU	256              ;  size of lazy read buffer   
;       OFT Hash Table Size   (8 bytes each)    
OFTHASHCNT	EQU	16            ;  16 hash chains for open files   
OFTHASHMSK	EQU	78H          ;  mask for computing hash offset   
;  Number of I/O command blocks which aren't associated with buffers   
IOBCNT	EQU	16               ;  16 should be enough   
;  # of OS/2 ram semaphores that we can be blocked on, simultaneously.   
SEMCNT	EQU	32 
; 
;* Cache Hash
;*
;* A sector hash is used to locate the start of a chain; the chain
;* is then scanned linearly.
;*
;* For our current size of 256 hash chains, we get:
;*
;* 1 meg of cache RAM =  512 blocks = 2 blocks per chain (average)
;* 2 meg of cache RAM = 1024 blocks = 4 blocks per chain (average)
;  
HASHCNT	EQU	256              ;  # of bytes of hash header   
;  Directory Lookaside record count   
; #define DLCNT         10              /* 10 guys for now */
; test
DLCNT	EQU	20               ;  20 entries   
;       Maximum DIRBLKs we may need to allocate for any given
;*      operation.  This is in effect the maximum tree depth.
;*
;*      Worst case, with 256 character file names and nearly empty
;*      DIRBLKs, 10 is enough levels for 60,000 files - about 40 megabytes
;*      of space just for that directory.  Given more practical file length
;*      names this is enough for 10s of millions of files in a directory.
;  
MAX_DIR_NEED	EQU	10 
;**     Special Transition Locking Structure size   
TRANCNT	EQU	4                ;  just need 4 spots   
;  Heap Definitions   
HHSIZ	EQU	4                ;  size, in bytes, of heap header   
;       Maximum number of volumes that we can mount
;*
;*      The volume ID is kept in the high bits of the sector numbers
;*      kept in our RAM structures,
;*      so there is a tradeoff between max volumes and max sectors.
;*
;*      32 max volumes gives us a 65 billion byte volume limit,
;*      which should last us for a while.  Since sector numbers
;*      are stored on the disk without their volume upper bits
;*      this is strictly an implimentation detail; we can adjust
;*      the number of volumes or eliminate this tradeoff in other
;*      implimentations which will be 100% media compatable.
;*
;*      We use the term VSector to indicate a vol/sector combination
;*      and PSector to indicate just the physical absolute sector #
;*
;  
VOLMNTMAX	EQU	27           ;  max 27 volumes mounted normally   
                                ;  see fsdata\fsdata.c for details   
                                ;  We don't use slot 0 - means volbits == 0;
;                                * 1-26 allows for drives A:-Z:
;                                  
MAXSEC	EQU	134217728        ;  2^32/32 max sectors   
SECMASK	EQU	07FFFFFFH       ;  mask for sector number   
HSECMASK	EQU	07H            ;  high byte sector mask   
HVOLMASK	EQU	0f8H            ;  high byte volume mask   
SVOLMASK	EQU	1fH            ;  shifted right volume mask   
VOLRSHIFT	EQU	(32 -5 )        ;  shift right to extract volume index   
VOLLSHIFT	EQU	5              ;  shift left  to extract volume index   
; 
;*      Signature Values for Disk Structures
;*
;*      These signature values help with debugging and they'll
;*      be used by the CHKDSK utility to help repair disks.
;  
VAL_J	EQU	((('J'-'A')*40 +('G'-'A'))*40 +'L'-'A')
VAL_R	EQU	((('R'-'A')*40 +('P'-'A'))*40 +'W'-'A')
;  indirect blks   
ABSIGVAL	EQU	(      VAL_J*40 *40 *40  +       VAL_R)
;  dir blks   
DBSIGVAL	EQU	(40000000H  +       VAL_J*40 *40 *40  +       VAL_R)
;  fnodes   
FNSIGVAL	EQU	(0C0000000H  +       VAL_J*40 *40 *40  +       VAL_R)
;**     FastFile bitmaps
;*
;*      0x00000000               all checking disabled
;*      0x00000001  FF_FLUSHLAZY DoZap lazy writes are automatically flushed
;*      0x00000002  FF_ZAPSEC    DoZap blasts sector numbers/sector data
;*      0x00000004  FF_LRUCHK    vbs verification of LRU/dirty integrity
;*      0x00000008  FF_CHKSUM    sector checksumming is omitted
;*      0x00000010  FF_PLACECHK  placebuf verifies location of buffer
;*      0x00000020  FF_HEAPCHK   verify heap headers
;*      0x00000040  FF_DIRMAP    produce in-RAM map of directory tree
;*      0x00000080  FF_HOLDLOG   produce log of hold inc/dec
;*      0x00000100  FF_CHKSBDIR  recursive SBDIR consistency checking
;*      0x00000200  FF_GETBUFS   check outstanding getbufs
;*      0x00000400  FF_CHKHCHN   check hash chains for all bufnodes
;  
FF_FLUSHLAZY	EQU	00000001H 
FF_ZAPSEC	EQU	00000002H 
FF_LRUCHK	EQU	00000004H 
FF_CHKSUM	EQU	00000008H 
FF_PLACECHK	EQU	00000010H 
FF_HEAPCHK	EQU	00000020H 
FF_DIRMAP	EQU	00000040H 
FF_HOLDLOG	EQU	00000080H 
FF_CHKSBDIR	EQU	00000100H 
FF_GETBUFS	EQU	00000200H 
FF_CHKHCHN	EQU	00000400H 
