; static char *SCCSID = "@(#)superb.h   6.2 91/10/20";  
;**     superb.h - Super Block Definition
;*
;*      HISTORY
;*          10-Jul-1989 by JR (John Rogers, JohnRo@Microsoft)
;*              - PTR B784106: Got rid of odd usage of SPF_HFUSED.
;*          14-Sep-1988 10:56 by Leif Pederson [leifp] re-synched w/Gordon
;*          8-Nov-1988  by Thomas Fenwick [thomasf] pickup volume changes
;*     @d01 73790  93SEP03 gy <Support V4FORMAT for HPFS386 extensions.
;*                            <GHASSAN@AUSVM1
;  
SEC_SUPERB	EQU	(      16 )      ;  superblock is sector 16    
SEC_SPAREB	EQU	(      17 )      ;  spareblock is sector 17    
; 
;*      Redundant sector pointer.
;  

RSP	STRUC
RSP_lsnMain	DD	?
RSP_lsnSpare	DD	?
RSP	ENDS
VOLNAMESIZE	EQU	32 

SUPERB	STRUC
SUPERB_sig1	DD	?         ;  SB_SIG1      signature value 1   
SUPERB_sig2	DD	?         ;  SB_SIG2      signature value 2   
SUPERB_bVersion	DB	?          ;  SB_VER       version # of filesystem structs   
SUPERB_bFuncVersion	DB	?   ;  SB_FVER     functional version number - the
;                                                                smallest/oldest version of the
;                                                           filesystem that can understand this
;                                                           disk - some version enhancements may
;                                                           define fields which can be ignored
;                                                                by earlier versions   
SUPERB_usDummy	DW	?            ;  SB_DUMY           free   
SUPERB_lsnRootFNode	DD	?       ;  SB_ROOT      Psector # of root fnode   
SUPERB_culSectsOnVol	DD	?    ;  SB_SEC       # of sectors on volume   
SUPERB_culNumBadSects	DD	?   ;  SB_BSEC      # of bad sectors on volume   
SUPERB_rspBitMapIndBlk	DB	SIZE RSP DUP (?)    ;  SB_BII       Bitmap Indirect Block   
SUPERB_rspBadBlkList	DB	SIZE RSP DUP (?)      ;  SB_BBL       badblock list chain #1   
SUPERB_datLastChkdsk	DD	?     ;  SB_CDDAT     date of last CHKDSK   
SUPERB_datLastOptimize	DD	?   ;  SB_DODAT     date of last Disk Optimize   
SUPERB_clsnDirBlkBand	DD	?   ;  SB_DBSIZE    # of sectors in dirblk band   
SUPERB_lsnFirstDirBlk	DD	?     ;  SB_DBLOW   first Psector in DIRBLK band   
SUPERB_lsnLastDirBlk	DD	?      ;  SB_DBHIGH    last Psector in DIRBLK band   
SUPERB_lsnDirBlkMap	DD	?       ;  SB_DBMAP   first Psector of DIRBLK band
;                                                                    bit map.  Starts on a 2K boundary,
;                                                                    2K bytes maximum   
SUPERB_achVolName	DB	VOLNAMESIZE DUP (?) ;  SB_VOLNAME        volume name   
SUPERB_lsnSidTab	DD	?             ;  SB_SIDSEC    sector number of SID table   
SUPERB_abFill	DB	SECSIZE-100 DUP (?) ;  SB_FILL    fill definition out to full sector  
SUPERB	ENDS
;**     SpareB - Spare Block Definitions
;*
;*      SpareB contains various emergency supplies and fixup information.
;*      This stuff isn't in the superblock in order for the superblock
;*      to be read only and decrease the liklihood that a flakey write
;*      will cause the superblock to become unreadable.
;*
;*      This sector is located directly after the superblock - sector 17.
;*
;*      Note that the number of spare DIRBLKs is a format option, given
;*      that they all have to fit into the SpareB, giving us a max of
;*      101 of them.
;*
;*      Checksums.  Done on both Super Block and the Spare Block.
;*      Both checksums are stored in the Spare Block.  The checksum
;*      field for the Super Block (SPB_SUPERBSUM) must be set when
;*      calculating the checksum for the Spare Block.  The checksum
;*      field for the Spare Block (SPB_SPAREBSUM) must be zero when
;*      calculating the checksum for the Spare Block.
;*      If both checksum fields are zero, the checksums have not been
;*      calculated for the volume.
;  
SPAREDB	EQU	20       ;  20 spare DIRBLKs   

SpareB	STRUC
SpareB_sig1	DD	?             ;  SPB_SIG1     signature value 1   
SpareB_sig2	DD	?             ;  SPB_SIG2     signature value 2   
SpareB_bFlag	DB	?                 ;  SPB_FLAG     cleanliness flag   
ifdef  V4FORMAT                ;  @d01   
SpareB_bFlag2	DB	?                ;  SPB_FLAG2    other flag  
SpareB_bContigFactor	DB	?         ;  SPB_CF       Contiguity Factor for MM   
SpareB_bAlign	DB	?                ;  SPB_ALIGN    alignment   
else
SpareB_bAlign	DB	3 DUP (?)             ;  SPB_ALIGN    alignment   
endif
SpareB_lsnHotFix	DD	?              ;  SPB_HFSEC    first hotfix list Psector   
SpareB_culHotFixes	DD	?          ;  SPB_HFUSE    # of hot fixes in effect   
SpareB_culMaxHotFixes	DD	?       ;  SPB_HFMAX    max size of hot fix list   
SpareB_cdbSpares	DD	?            ;  SPB_SDBCNT   # of spare dirblks   
SpareB_cdbMaxSpare	DD	?          ;  SPB_SDBMAX   max num of spare DB values.   
SpareB_lsnCPInfo	DD	?              ;  SPB_xxxxx    code page info sector   
SpareB_culCP	DD	?                ;  SPB_xxxxx    number of code pages   
SpareB_SPB_SUPERBSUM	DD	?        ;  Checksum of Super Block   
SpareB_SPB_SPAREBSUM	DD	?        ;  Checksum of Spare Block   
SpareB_aulExtra	DD	15 DUP (?)         ;  some extra space for future use   
SpareB_alsnSpareDirBlks	DD	101 DUP (?)  ;  SPB_SPARDB   Psector #s of spare dirblks   
SpareB	ENDS
;       Super Block Signature   
SBSIG1	EQU	0f995e849H               ;  two signatures cause we got lotsa   
SBSIG2	EQU	0FA53E9C5H               ;  space          
;       Spare Block Signature   
SPSIG1	EQU	0f9911849H               ;  two signatures cause we got lotsa   
SPSIG2	EQU	0FA5229C5H               ;  space          
;       Superblock Versions   
SBBASEV	EQU	2                  ; base version   
ifdef  V4FORMAT
;   We use version v4 to describe all sizes (in contrast to v3 and v2).
;*  Version 4 supports the following extensions:
;*              MultiMedia, DASD Limits, and DCE ACLs
;  
SBBASEFV	EQU	4    ;  DASD LIMITS, MM, DACLs               
SBBASEOLDFV_BIGDISK	EQU	3    ; base functional version (3=bigdisk)   
SBBASEOLDFV	EQU	2    ; base functional version (2=<2gbdisk)  
;**  Values for SPB_FLAG2  *  
SPF2_DASD_INSTALL	EQU	01H   ;  Install DASD LIMITS           
SPF2_DASD_SYNCH	EQU	02H   ;  Resynch DR_USE information    
SPF2_DASD_RUNNING	EQU	04H   ;  DASD LIMITS operational       
SPF2_MM	EQU	08H   ;  MultiMedia active             
SPF2_DCE_ACL	EQU	10H   ;  DCE ACLs active               
SPF2_DASD_DIRTY	EQU	20H   ;  DASD Limits: disk is dirty    
SPF2_DASD_SUPPORT	EQU	(SPF2_DASD_RUNNING OR SPF2_DASD_SYNCH OR SPF2_DASD_INSTALL)
else
SBBASEFV	EQU	3                  ; base functional version (3=bigdisk)  
SBBASEOLDFV	EQU	2                  ; base functional version (2=<2gbdisk)  
endif
;       Spare Block Flags
;  
SPF_DIRT	EQU	0001H           ;  file system is dirty   
SPF_SPARE	EQU	0002H           ;  spare DIRBLKs have been used   
SPF_HFUSED	EQU	0004H           ;  hot fix sectors have been used   
SPF_BADSEC	EQU	0008H           ;  bad sector, corrupt disk   
SPF_BADBM	EQU	0010H           ;  bad bitmap block   
; #86635
SPF_FASTFMT	EQU	0020H           ;  fast-formatted volume   
SPF_VER	EQU	0080H           ;  file system was written by a version
;                                 * < SB_VER, so some of the new fields
;                                                          * may have not been updated   
;**      Bit maps
;*
;*      PFS keeps track of free space in a series of bit maps.
;*      Currently, each bit map is 2048 bytes, which covers about
;*      8 megabytes of disk space.  We could rearrange these to be
;*      more cylinder sensitive...
;*
;*      The superblock has the address of a section of contiguous sectors
;*      that contains a double word sector # for each bit map block.  This
;*      will be a maximum of 2048 bytes (4 sectors)
;*
;*  Max # of   size     RAM (K)    size 2nd lvl
;*   bitmaps   (meg)   to reside    bitmap
;*                       bitmap      (bytes)
;*
;*      1      8.39         2       256
;*      2     16.78         4       512
;*      3     25.17         6       768
;*      4     33.55         8      1024
;*      5     41.94        10      1280
;*      6     50.33        12      1536
;*      7     58.72        14      1792
;*      8     67.11        16      2048
;*      9     75.50        18      2304
;*     10     83.89        20      2560
;*     15    125.83        30      3840
;*     20    167.77        40      5120
;*     30    251.66        60      7680
;*     40    335.54        80     10240
;*     50    419.43       100     12800
;*    100    838.86       200     25600
;*    200   1677.72       400     51200
;*    300   2516.58       600     76800
;*    400   3355.44       800    102400
;*    500   4194.30      1000    128000
;  
;**     Hot Fixing
;*
;*      Each file system maintains a structure listing N "hot fix"
;*      disk clusters of HOTFIXSIZ sectors each, each starting on
;*      a multiple of HOTFIXSIZ.  Whenever the file system discovers
;*      that it's trying to write to a bad spot on the disk it will
;*      instead select a free hot fix cluster and write there, instead.
;*      The substitution will be recorded in the hot fix list, and the
;*      SBF_SPARE bit will be set.  The file system sill describes the
;*      data as being in the bad old sectors; the disk interface will
;*      do a mapping between the `believed' location and the true location.
;*
;*      CHKDSK will be run as soon as possible; it will move the
;*      hot fixed data from the hot fix cluster to somewhere else,
;*      freeing that hot fix cluster, and adjusting the disk structure
;*      to point to the new location of the data.  As a result, entrys
;*      on the hot fix list should be transient and few.
;*
;*      The superblock contains the first sector of the hot fix list
;*      which takes the following format:
;*
;*      long oldsec[SB_HFMAX];          sector # of start of bad clusters
;*      long newsec[SB_HFMAX];          sector # of start of subst. cluster
;*      long fnode [SB_HFMAX];          fnode sector of file/directory
;*                                      involved with bad cluster.  May be
;*                                      0 (don't know) or invalid.  The
;*                                      repair program must verify that it
;*                                      *is* an FNODE and must see if other
;*                                      structures might also involve this
;*                                      bad cluster.
;*
;*      the SB_HFUSE field describes the number of these records which is
;*      in use - unused ones should have oldsec[i] = 0.  The list will
;*      be 'dense' - no oldsec[i] will be 0 where i < SB_HFUSE.
;*
;*      The sector(s) which contain the hot fix list must be contiguous
;*      and may not themselves be defective.
;  
