;
; ** $VER: filehandler.h 36.6 (9.8.92)
; ** Includes Release 40.15
; **
; ** device and file handler specific code for AmigaDOS
; **
; ** (C) Copyright 1986-1993 Commodore-Amiga, Inc.
; **     All Rights Reserved
;

IncludePath   "PureInclude:"
XIncludeFile "exec/ports.pb"
;XIncludeFile "dos/dos.pb"


;  The disk "environment" is a longword array that describes the
;  * disk geometry.  It is variable sized, with the length at the beginning.
;  * Here are the constants for a standard geometry.
;

Structure DosEnvec
    de_TableSize.l      ;  Size of Environment vector
    de_SizeBlock.l      ;  in longwords: standard value is 128
    de_SecOrg.l      ;  not used; must be 0
    de_Surfaces.l      ;  # of heads (surfaces). drive specific
    de_SectorPerBlock.l ;  not used; must be 1
    de_BlocksPerTrack.l ;  blocks per track. drive specific
    de_Reserved.l      ;  DOS reserved blocks at start of partition.
    de_PreAlloc.l      ;  DOS reserved blocks at end of partition
    de_Interleave.l     ;  usually 0
    de_LowCyl.l      ;  starting cylinder. typically 0
    de_HighCyl.l      ;  max cylinder. drive specific
    de_NumBuffers.l     ;  Initial # DOS of buffers.
    de_BufMemType.l     ;  type of mem to allocate for buffers
    de_MaxTransfer.l    ;  Max number of bytes to transfer at a time
    de_Mask.l      ;  Address Mask to block out certain memory
    de_BootPri.l      ;  Boot priority for autoboot
    de_DosType.l      ;  ASCII (HEX) string showing filesystem type;
;          * 0X444F5300 is old filesystem,
;          * 0X444F5301 is fast file system
    de_Baud.l      ;  Baud rate for serial handler
    de_Control.l      ;  Control word for handler/filesystem
    de_BootBlocks.l     ;  Number of blocks containing boot code

EndStructure

;  these are the offsets into the array
;  DE_TABLESIZE is set to the number of longwords in the table minus 1

#DE_TABLESIZE = 0 ;  minimum value is 11 (includes NumBuffers)
#DE_SIZEBLOCK = 1 ;  in longwords: standard value is 128
#DE_SECORG = 2 ;  not used; must be 0
#DE_NUMHEADS = 3 ;  # of heads (surfaces). drive specific
#DE_SECSPERBLK = 4 ;  not used; must be 1
#DE_BLKSPERTRACK = 5 ;  blocks per track. drive specific
#DE_RESERVEDBLKS = 6 ;  unavailable blocks at start.  usually 2
#DE_PREFAC = 7 ;  not used; must be 0
#DE_INTERLEAVE = 8 ;  usually 0
#DE_LOWCYL = 9 ;  starting cylinder. typically 0
#DE_UPPERCYL = 10 ;  max cylinder.  drive specific
#DE_NUMBUFFERS = 11 ;  starting # of buffers.  typically 5
#DE_MEMBUFTYPE = 12 ;  type of mem to allocate for buffers.
#DE_BUFMEMTYPE = 12 ;  same as above, better name
;      * 1 is public, 3 is chip, 5 is fast
#DE_MAXTRANSFER = 13 ;  Max number bytes to transfer at a time
#DE_MASK  = 14 ;  Address Mask to block out certain memory
#DE_BOOTPRI = 15 ;  Boot priority for autoboot
#DE_DOSTYPE = 16 ;  ASCII (HEX) string showing filesystem type;
;      * 0X444F5300 is old filesystem,
;      * 0X444F5301 is fast file system
#DE_BAUD  = 17 ;  Baud rate for serial handler
#DE_CONTROL = 18 ;  Control word for handler/filesystem
#DE_BOOTBLOCKS = 19 ;  Number of blocks containing boot code

;  The file system startup message is linked into a device node's startup
; ** field.  It contains a pointer to the above environment, plus the
; ** information needed to do an exec OpenDevice().
;
Structure FileSysStartupMsg
    fssm_Unit.l ;  exec unit number for this device
    fssm_Device.l ;  null terminated bstring to the device name
    fssm_Environ.l ;  ptr to environment table (see above)
    fssm_Flags.l ;  flags for OpenDevice()
EndStructure


;  The include file "libraries/dosextens.h" has a DeviceList structure.
;  * The "device list" can have one of three different things linked onto
;  * it. Dosextens defines the structure for a volume.  DLT_DIRECTORY
;  * is for an assigned directory.  The following structure is for
;  * a dos "device" (DLT_DEVICE).
;

Structure DeviceNode
    dn_Next.l ;  singly linked list
    dn_Type.l ;  always 0 for dos "devices"
    *dn_Task.MsgPort ;  standard dos "task" field.  If this is
;      * null when the node is accesses, a task
;      * will be started up
    dn_Lock.l ;  not used for devices -- leave null
    dn_Handler.l ;  filename to loadseg (if seglist is null)
    dn_StackSize.l ;  stacksize to use when starting task
    dn_Priority.l ;  task priority when starting task
    dn_Startup.l ;  startup msg: FileSysStartupMsg for disks
    dn_SegList.l ;  code to run to start new task (if necessary).
;      * if null then dn_Handler will be loaded.
    dn_GlobalVec.l ;  BCPL global vector to use when starting
;      * a task.  -1 means that dn_SegList is not
;      * for a bcpl program, so the dos won't
;      * try and construct one.  0 tell the
;      * dos that you obey BCPL linkage rules,
;      * and that it should construct a global
;      * vector for you.
;
    dn_Name.l ;  the node name, e.g. '\3','D','F','3'
EndStructure

