3 * Revision 10.9 1998/09/03 07:12:14 Michiel
6 * Revision 10.8 1998/05/27 20:16:13 Michiel
9 * Revision 10.7 1997/03/03 22:04:04 Michiel
12 * Revision 10.6 1995/02/15 16:43:39 Michiel
14 * Using new headers (struct.h & blocks.h)
16 * Revision 10.5 1995/01/29 07:34:57 Michiel
19 * Revision 10.4 1995/01/18 04:29:34 Michiel
22 * Revision 10.3 1995/01/13 15:22:16 Michiel
24 * bug fixed, can format while debugging now
26 * Revision 10.2 1994/11/15 17:52:30 Michiel
27 * Mounts on harddisk now
29 * Revision 10.1 1994/10/24 11:16:28 Michiel
33 /* Copyright (c) 1994 Doug Walker, Raleigh, NC */
34 /* All Rights Reserved. */
38 #include <dos/filehandler.h>
39 #include <exec/memory.h>
40 #include <exec/execbase.h>
41 #include <proto/exec.h>
42 #include <proto/dos.h>
51 int DisMount(struct DeviceList
*volume
);
52 struct DeviceNode
*Mount(char *name
, struct MsgPort
*port
);
54 #define V37 (SysBase->LibNode.lib_Version > 36)
56 //static __aligned UBYTE devicename[] = {15,'o','k','t','a','g','o','n','.','d','e','v','i','c','e',0};
57 //static __aligned UBYTE devicename[] = "\0172nd.scsi.device";
58 static __aligned UBYTE devicename
[] = "\013scsi.device";
60 /* Mount a volume with the given name; route all handler
61 ** messages to the given port.
63 struct DeviceNode
*Mount(char *name
, struct MsgPort
*port
)
65 struct DeviceNode
*volume
;
66 struct DosList
*dlist
;
67 struct FileSysStartupMsg
*fssm
= AllocVec(sizeof(struct FileSysStartupMsg
), MEMF_CLEAR
);
68 struct DosEnvec
*dosenvec
= AllocVec(sizeof(struct DosEnvec
), MEMF_CLEAR
);
70 if(name
== NULL
|| port
== NULL
) return NULL
;
73 /* test: bpt=8,hc=1250000 */
74 /* zip: bpt=8,hc=24575 */
75 dosenvec
->de_TableSize
= 17;
76 dosenvec
->de_SizeBlock
= 128;
77 dosenvec
->de_Surfaces
= 16; // 1; // !!
78 dosenvec
->de_SectorPerBlock
= 1;
79 dosenvec
->de_BlocksPerTrack
= 63; // 8; //555; // !!
80 dosenvec
->de_Reserved
= 2;
81 dosenvec
->de_LowCyl
= 2; // 0; // !!
82 dosenvec
->de_HighCyl
= 14759; // 1250000; // !!
83 dosenvec
->de_NumBuffers
= 350;
84 dosenvec
->de_BufMemType
= 0;
85 dosenvec
->de_MaxTransfer
= 0x1ffff;
86 dosenvec
->de_Mask
= 0x7ffffffe;
87 dosenvec
->de_DosType
= 0x6d757577; //ID_MUAF_DISK; // 0x6D754653; //ID_PFS_DISK or just fun: 0x6d757575;
88 dosenvec
->de_BootBlocks
= 2;
91 fssm
->fssm_Unit
= 1; // 5; // !!
92 fssm
->fssm_Device
= MKBADDR(devicename
);
93 fssm
->fssm_Environ
= MKBADDR(dosenvec
);
96 while(!(dlist
= AttemptLockDosList(LDF_DEVICES
|LDF_WRITE
)))
98 /* Can't lock the DOS list. Wait a second and try again. */
101 volume
= (struct DeviceNode
*)FindDosEntry(dlist
, name
, LDF_DEVICES
);
102 if(volume
) RemDosEntry((struct DosList
*)volume
);
103 UnLockDosList(LDF_DEVICES
|LDF_WRITE
);
105 if(!volume
&& !(volume
= (struct DeviceNode
*)MakeDosEntry(name
, DLT_DEVICE
)))
108 volume
->dn_Startup
= MKBADDR(fssm
);
109 volume
->dn_Lock
= NULL
;
110 volume
->dn_GlobalVec
= -1;
112 /* Now we can own the volume by giving it our msgport */
113 volume
->dn_Task
= port
;
115 while(!(dlist
= AttemptLockDosList(LDF_DEVICES
|LDF_WRITE
)))
117 /* Oops, can't lock DOS list. Wait 1 second and retry. */
120 AddDosEntry((struct DosList
*)volume
);
121 UnLockDosList(LDF_DEVICES
|LDF_WRITE
);