revert between 56095 -> 55830 in arch
[AROS.git] / rom / filesys / pfs3 / fs / mountf.c
bloba24ee915ac8b4438d7ec2bfbf7c4ea3c8a38cd8f
1 /* $Id$ */
2 /* $Log: mountf.c $
3 * Revision 1.1 1997/03/03 22:04:04 Michiel
4 * Initial revision
6 * Revision 10.6 1995/02/15 16:43:39 Michiel
7 * Release version
8 * Using new headers (struct.h & blocks.h)
10 * Revision 10.5 1995/01/29 07:34:57 Michiel
11 * Other disk specs
13 * Revision 10.4 1995/01/18 04:29:34 Michiel
14 * Less_buffers
16 * Revision 10.3 1995/01/13 15:22:16 Michiel
17 * mounts on dh1 now
18 * bug fixed, can format while debugging now
20 * Revision 10.2 1994/11/15 17:52:30 Michiel
21 * Mounts on harddisk now
23 * Revision 10.1 1994/10/24 11:16:28 Michiel
24 * first RCS revision
25 * */
27 /* Copyright (c) 1994 Doug Walker, Raleigh, NC */
28 /* All Rights Reserved. */
29 #define __USE_SYSBASE
31 #include <dos/dos.h>
32 #include <dos/filehandler.h>
33 #include <exec/memory.h>
34 #include <exec/execbase.h>
35 #include <proto/exec.h>
36 #include <proto/dos.h>
38 #include <string.h>
40 //#include "mount.h"
41 #include "blocks.h"
42 #include "struct.h"
44 /* protos */
45 int DisMount(struct DeviceList *volume);
46 struct DeviceNode *Mount(char *name, struct MsgPort *port);
48 #define V37 (SysBase->LibNode.lib_Version > 36)
50 static __aligned UBYTE devicename[] = {16,'t','r','a','c','k','d','i','s','k','.','d','e','v','i','c','e',0};
52 /* Mount a volume with the given name; route all handler
53 ** messages to the given port.
55 struct DeviceNode *Mount(char *name, struct MsgPort *port)
57 struct DeviceNode *volume;
58 struct DosList *dlist;
59 struct FileSysStartupMsg *fssm = AllocVec(sizeof(struct FileSysStartupMsg), MEMF_CLEAR);
60 struct DosEnvec *dosenvec = AllocVec(sizeof(struct DosEnvec), MEMF_CLEAR);
62 if(name == NULL || port == NULL) return NULL;
64 /* make dosenvec */
66 dosenvec->de_TableSize = 17;
67 dosenvec->de_SizeBlock = 128;
68 dosenvec->de_Surfaces = 2;
69 dosenvec->de_SectorPerBlock = 1;
70 dosenvec->de_BlocksPerTrack = 11;
71 dosenvec->de_Reserved = 2;
72 dosenvec->de_LowCyl = 0;
73 dosenvec->de_HighCyl = 79;
74 dosenvec->de_NumBuffers = 100;
75 dosenvec->de_BufMemType = 0;
76 dosenvec->de_MaxTransfer = 0xffffff;
77 dosenvec->de_Mask = 0x7ffffffe;
78 dosenvec->de_DosType = ID_PFS_DISK;
79 dosenvec->de_BootBlocks = 2;
81 /* make fssm */
83 fssm->fssm_Unit = 0;
84 fssm->fssm_Device = MKBADDR(devicename);
85 fssm->fssm_Environ = MKBADDR(dosenvec);
86 fssm->fssm_Flags = 0;
88 while(!(dlist = AttemptLockDosList(LDF_DEVICES|LDF_WRITE)))
90 /* Can't lock the DOS list. Wait a second and try again. */
91 Delay(50);
93 volume = (struct DeviceNode *)FindDosEntry(dlist, name, LDF_DEVICES);
94 if(volume) RemDosEntry((struct DosList *)volume);
95 UnLockDosList(LDF_DEVICES|LDF_WRITE);
97 if(!volume && !(volume = (struct DeviceNode *)MakeDosEntry(name, DLT_DEVICE)))
98 return NULL;
100 volume->dn_Startup = MKBADDR(fssm);
101 volume->dn_Lock = NULL;
102 volume->dn_GlobalVec = -1;
104 /* Now we can own the volume by giving it our msgport */
105 volume->dn_Task = port;
107 while(!(dlist = AttemptLockDosList(LDF_DEVICES|LDF_WRITE)))
109 /* Oops, can't lock DOS list. Wait 1 second and retry. */
110 Delay(50);
112 AddDosEntry((struct DosList *)volume);
113 UnLockDosList(LDF_DEVICES|LDF_WRITE);
115 return volume;