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