home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / HardBlocks.def < prev    next >
Encoding:
Text File  |  1993-11-03  |  10.0 KB  |  226 lines

  1. DEFINITION FOR C MODULE HardBlocks ;
  2.  
  3. FROM SYSTEM IMPORT LONGSET ;
  4.  
  5. TYPE
  6.   RigidDiskBlockPtr    = POINTER TO RigidDiskBlock    ;
  7.   BadBlockEntryPtr    = POINTER TO BadBlockEntry    ;
  8.   BadBlockBlockPtr    = POINTER TO BadBlockBlock    ;
  9.   PartitionBlockPtr    = POINTER TO PartitionBlock    ;
  10.   FileSysHeaderBlockPtr = POINTER TO FileSysHeaderBlock ;
  11.   LoadSegBlockPtr    = POINTER TO LoadSegBlock    ;
  12.  
  13. (*--------------------------------------------------------------------
  14.  *
  15.  *    This file describes blocks of data that exist on a hard disk
  16.  *    to describe that disk.  They are not generically accessable to
  17.  *    the user as they do not appear on any DOS drive.  The blocks
  18.  *    are tagged with a unique identifier, checksummed, and linked
  19.  *    together.  The root of these blocks is the RigidDiskBlock.
  20.  *
  21.  *    The RigidDiskBlock must exist on the disk within the first
  22.  *    RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  23.  *    cylinder in an AmigaDOS partition: although it is strictly
  24.  *    possible to store the RigidDiskBlock data in the reserved
  25.  *    area of a partition, this practice is discouraged since the
  26.  *    reserved blocks of a partition are overwritten by "Format",
  27.  *    "Install", "DiskCopy", etc.  The recommended disk layout,
  28.  *    then, is to use the first cylinder(s) to store all the drive
  29.  *    data specified by these blocks: i.e. partition descriptions,
  30.  *    file system load images, drive bad block maps, spare blocks,
  31.  *    etc.
  32.  *
  33.  *    Though only 512 byte blocks are currently supported by the
  34.  *    file system, this proposal tries to be forward-looking by
  35.  *    making the block size explicit, and by using only the first
  36.  *    256 bytes for all blocks but the LoadSeg data.
  37.  *
  38.  *------------------------------------------------------------------*)
  39.  
  40. (*  NOTE                                *)
  41. (*    optional block addresses below contain FFFFFFFFH to indicate    *)
  42. (*    a NULL address, as zero is a valid address            *)
  43.  
  44. TYPE
  45.   RigidDiskBlock = RECORD
  46.     rdb_ID           : LONGINT ; (* 4 character identifier          *)
  47.     rdb_SummedLongs       : LONGINT ; (* size of this checksummed structure  *)
  48.     rdb_ChkSum           : LONGINT ; (* block checksum(longword sum to zero)*)
  49.     rdb_HostID           : LONGINT ; (* SCSI Target ID of host          *)
  50.     rdb_BlockBytes       : LONGINT ; (* size of disk blocks              *)
  51.     rdb_Flags           : LONGSET ; (* see below for defines              *)
  52.  
  53.     (* block list heads *)
  54.  
  55.     rdb_BadBlockList       : LONGINT ; (* optional bad block list        *)
  56.     rdb_PartitionList       : LONGINT ; (* optional first partition block    *)
  57.     rdb_FileSysHeaderList  : LONGINT ; (* optional file system header block *)
  58.     rdb_DriveInit       : LONGINT ; (* optional drive-specific init code *)
  59.                   (* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 *)
  60.  
  61.     rdb_Reserved1       : ARRAY [0..5] OF LONGINT; (* set to FFFFFFFFH *)
  62.  
  63.     (* physical drive characteristics *)
  64.  
  65.     rdb_Cylinders    : LONGINT ; (* number of drive cylinders*)
  66.     rdb_Sectors        : LONGINT ; (* sectors per track    *)
  67.     rdb_Heads        : LONGINT ; (* number of drive heads    *)
  68.     rdb_Interleave    : LONGINT ; (* interleave        *)
  69.     rdb_Park        : LONGINT ; (* landing zone cylinder    *)
  70.     rdb_Reserved2    : ARRAY [0..2] OF LONGINT ;
  71.     rdb_WritePreComp    : LONGINT ;(* starting cylinder:write precompensation *)
  72.     rdb_ReducedWrite    : LONGINT ;(* starting cylinder:reduced write current *)
  73.     rdb_StepRate    : LONGINT ;(* drive step rate                  *)
  74.     rdb_Reserved3    : ARRAY [0..4] OF LONGINT ;
  75.  
  76.     (* logical drive characteristics *)
  77.  
  78.     rdb_RDBBlocksLo     : LONGINT;(* low block of range reserved forhardblocks*)
  79.     rdb_RDBBlocksHi     : LONGINT;(* high block of range for these hardblocks *)
  80.     rdb_LoCylinder    : LONGINT;(* low cylinder of partitionable disk area  *)
  81.     rdb_HiCylinder    : LONGINT;(* high cylinder of partitionable data area *)
  82.     rdb_CylBlocks    : LONGINT;(* number of blocks available per cylinder  *)
  83.     rdb_AutoParkSeconds : LONGINT;(* zero for no auto park              *)
  84.     rdb_Reserved4    : ARRAY [0..1] OF LONGINT;
  85.  
  86.     (* drive identification *)
  87.  
  88.     rdb_DiskVendor       : ARRAY [0..07] OF CHAR ;
  89.     rdb_DiskProduct       : ARRAY [0..15] OF CHAR ;
  90.     rdb_DiskRevision       : ARRAY [0..03] OF CHAR ;
  91.     rdb_ControllerVendor   : ARRAY [0..07] OF CHAR ;
  92.     rdb_ControllerProduct  : ARRAY [0..15] OF CHAR ;
  93.     rdb_ControllerRevision : ARRAY [0..03] OF CHAR ;
  94.     rdb_Reserved5       : ARRAY [0..09] OF LONGINT ;
  95.   END;
  96.  
  97. CONST
  98.   IDNAME_RIGIDDISK    = 5244534BH ;   (* RDSK *)
  99.  
  100.   RDB_LOCATION_LIMIT    = 16  ;
  101.  
  102.   RDBFB_LAST        =  0  ;    (* no disks exist to be configured after      *)
  103.   RDBFF_LAST        = {0} ;    (* this one on this controller              *)
  104.   RDBFB_LASTLUN        =  1  ;    (* no LUNs exist to be configured greater     *)
  105.   RDBFF_LASTLUN        = {1} ;    (* than this one at this SCSI Target ID       *)
  106.   RDBFB_LASTTID        =  2  ;    (* no Target IDs exist to be configured       *)
  107.   RDBFF_LASTTID        = {2} ;    (* greater than this one on this SCSI bus     *)
  108.   RDBFB_NORESELECT    =  3  ;    (* don't bother trying to perform reselection *)
  109.   RDBFF_NORESELECT    = {3} ;    (* when talking to this drive              *)
  110.   RDBFB_DISKID        =  4  ;    (* rdb_Disk... identification valid          *)
  111.   RDBFF_DISKID        = {4} ;
  112.   RDBFB_CTRLRID        =  5  ;    (* rdb_Controller... identification valid     *)
  113.   RDBFF_CTRLRID        = {5} ;
  114.                 (* added 7/20/89 by commodore:              *)
  115.   RDBFB_SYNCH        = 6   ;    (* drive supports scsi synchronous mode          *)
  116.   RDBFF_SYNCH        = {6} ; (* CAN BE DANGEROUS TO USE IF IT DOESN'T!     *)
  117.  
  118. (*------------------------------------------------------------------*)
  119.  
  120. TYPE
  121.   BadBlockEntry = RECORD
  122.     bbe_BadBlock  : LONGINT ; (* block number of bad block       *)
  123.     bbe_GoodBlock : LONGINT ; (* block number of replacement block *)
  124.   END;
  125.  
  126.   BadBlockBlock = RECORD
  127.     bbb_ID        : LONGINT ; (* 4 character identifier              *)
  128.     bbb_SummedLongs    : LONGINT ; (* size of this checksummed structure     *)
  129.     bbb_ChkSum        : LONGINT ; (* block checksum (longword sum to zero)  *)
  130.     bbb_HostID        : LONGINT ; (* SCSI Target ID of host              *)
  131.     bbb_Next        : LONGINT ; (* block number of the next BadBlockBlock *)
  132.     bbb_Reserved    : LONGINT ;
  133.     bbb_BlockPairs    : ARRAY [0..60] OF BadBlockEntry ;
  134.                 (* bad block entry pairs        *)
  135.             (* note [0..60] assumes 512 byte blocks *)
  136.   END;
  137.  
  138. CONST
  139.    IDNAME_BADBLOCK = 42414442H ;   (* BADB *)
  140.  
  141. (*------------------------------------------------------------------*)
  142.  
  143. TYPE
  144.   PartitionBlock = RECORD
  145.     pb_ID       : LONGINT ;    (* 4 character identifier           *)
  146.     pb_SummedLongs : LONGINT ;    (* size of this checksummed structure      *)
  147.     pb_ChkSum       : LONGINT ;    (* block checksum (longword sum to zero)   *)
  148.     pb_HostID       : LONGINT ;    (* SCSI Target ID of host           *)
  149.     pb_Next       : LONGINT ;    (* block number of the next PartitionBlock *)
  150.     pb_Flags       : LONGSET ;    (* see below for defines           *)
  151.     pb_Reserved1   : ARRAY [0..1] OF LONGINT ;
  152.     pb_DevFlags       : LONGSET ;    (* preferred flags for OpenDevice       *)
  153.     pb_DriveName   : ARRAY [0..31] OF CHAR ;
  154.                     (* preferred DOS device name: BSTR form    *)
  155.                 (* (not used if this name is in use)       *)
  156.     pb_Reserved2   : ARRAY [0..14] OF LONGINT ;
  157.                     (* filler to 32 longwords           *)
  158.     pb_Environment : ARRAY [0..16] OF LONGINT ;
  159.                     (* environment vector for this partition   *)
  160.     pb_EReserved   : ARRAY [0..14] OF LONGINT ;
  161.                     (* reserved for future environment vector  *)
  162.   END;
  163.  
  164. CONST
  165.   IDNAME_PARTITION = 50415254H ;    (* PART *)
  166.  
  167.   PBFB_BOOTABLE       =  0  ; (* this partition is intended to be bootable  *)
  168.   PBFF_BOOTABLE       = {0} ; (*  (expected directories and files exist)    *)
  169.  
  170.   PBFB_NOMOUNT       =  1  ; (* do not mount this partition (e.g. manually *)
  171.   PBFF_NOMOUNT       = {1} ; (*  mounted, but space reserved here)     *)
  172.  
  173. (*------------------------------------------------------------------*)
  174.  
  175. TYPE
  176.   FileSysHeaderBlock = RECORD
  177.     fhb_ID        : LONGINT ;    (* 4 character identifier             *)
  178.     fhb_SummedLongs : LONGINT ;    (* size of this checksummed structure         *)
  179.     fhb_ChkSum        : LONGINT ;    (* block checksum (longword sum to zero)     *)
  180.     fhb_HostID        : LONGINT ;    (* SCSI Target ID of host             *)
  181.     fhb_Next        : LONGINT ;    (* block number of next FileSysHeaderBlock   *)
  182.     fhb_Flags        : LONGSET ;    (* see below for defines             *)
  183.     fhb_Reserved1   : ARRAY [0..1] OF LONGINT ;
  184.     fhb_DosType        : LONGINT ;    (* file system description: match this with  *)
  185.                 (* partition environment's DE_DOSTYPE entry  *)
  186.     fhb_Version        : LONGINT ;    (* release version of this code             *)
  187.     fhb_PatchFlags  : LONGSET ;    (* bits set for those of the following that  *)
  188.                 (*   need to be substituted into a standard  *)
  189.                 (*   device node for this file system: e.g.  *)
  190.                 (*   0x180 to substitute SegList & GlobalVec *)
  191.     fhb_Type        : LONGINT ;    (* device node TYPE: zero             *)
  192.     fhb_Task        : LONGINT ;    (* standard dos "task" field: zero         *)
  193.     fhb_Lock        : LONGINT ;    (* not used for devices: zero             *)
  194.     fhb_Handler        : LONGINT ;    (* filename to loadseg: zero placeholder     *)
  195.     fhb_StackSize   : LONGINT ;    (* stacksize to use when starting task         *)
  196.     fhb_Priority    : LONGINT ;    (* task priority when starting task         *)
  197.     fhb_Startup     : LONGINT ;    (* startup msg: zero placeholder         *)
  198.     fhb_SegListBlocks : LONGINT;(* first of linked list of LoadSegBlocks:    *)
  199.                 (*   note that this entry requires some      *)
  200.                 (*   processing before substitution         *)
  201.     fhb_GlobalVec : LONGINT ;   (* BCPL global vector when starting task     *)
  202.     fhb_Reserved2 : ARRAY [0..22] OF LONGINT;(*(those reserved by PatchFlags)*)
  203.     fhb_Reserved3 : ARRAY [0..20] OF LONGINT;
  204.   END;
  205.  
  206. CONST
  207.   IDNAME_FILESYSHEADER = 46534844H ; (* FSHD *)
  208.  
  209. (*------------------------------------------------------------------*)
  210.  
  211. TYPE
  212.   LoadSegBlock = RECORD
  213.     lsb_ID        : LONGINT ;    (* 4 character identifier         *)
  214.     lsb_SummedLongs : LONGINT ;    (* size of this checksummed structure     *)
  215.     lsb_ChkSum        : LONGINT ;    (* block checksum (longword sum to zero) *)
  216.     lsb_HostID        : LONGINT ;    (* SCSI Target ID of host         *)
  217.     lsb_Next        : LONGINT ;    (* block number of the next LoadSegBlock *)
  218.     lsb_LoadData    : ARRAY [0..122] OF LONGINT ;  (* data for "loadseg" *)
  219.     (* note [123] assumes 512 byte blocks *)
  220.   END;
  221.  
  222. CONST
  223.   IDNAME_LOADSEG = 4C534547H ; (* LSEG *)
  224.  
  225. END HardBlocks.
  226.