2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
10 #include <dos/dosextens.h>
11 #include <dos/filesystem.h>
12 #include <exec/memory.h>
13 #include <proto/dos.h>
14 #include <proto/exec.h>
15 #include "dos_intern.h"
20 struct Device
*GetDosType(ULONG type
, CONST_STRPTR name
, struct Unit
**unit
,
21 struct DosLibrary
*DOSBase
);
24 void InitIOFS(struct IOFileSys
*iofs
, ULONG type
,
25 struct DosLibrary
*DOSBase
)
27 struct Process
*me
= (struct Process
*)FindTask(NULL
);
29 iofs
->IOFS
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
30 iofs
->IOFS
.io_Message
.mn_ReplyPort
= &me
->pr_MsgPort
;
31 iofs
->IOFS
.io_Message
.mn_Length
= sizeof(struct IOFileSys
);
32 iofs
->IOFS
.io_Command
= type
;
33 iofs
->IOFS
.io_Flags
= 0;
36 struct Device
*GetDevice(CONST_STRPTR name
, struct Unit
**unit
,
37 struct DosLibrary
*DOSBase
)
39 return GetDosType(LDF_DEVICES
, name
, unit
, DOSBase
);
40 // return GetDosType(DLT_DEVICE, name, unit, DOSBase);
44 struct Device
*GetVolume(CONST_STRPTR name
, struct Unit
**unit
,
45 struct DosLibrary
*DOSBase
)
47 return GetDosType(LDF_VOLUMES
, name
, unit
, DOSBase
);
48 // return GetDosType(DLT_VOLUME, name, unit, DOSBase);
52 /* Return the device corresponding to the 'name'. This function will
53 only look into "real" devices, that is no "PROGDIR:" or such.
54 The pointer to the device unit will be written into 'unit' if
55 'unit' is not NULL. */
56 struct Device
*GetDosType(ULONG type
, CONST_STRPTR name
, struct Unit
**unit
,
57 struct DosLibrary
*DOSBase
)
59 int len
= strlen(name
);
61 STRPTR colon
= strchr(name
, ':');
64 struct Device
*device
= NULL
;
74 /* Not only a device name with trailing colon? */
80 tempName
= AllocVec(len
, MEMF_ANY
);
87 CopyMem(name
, tempName
, size
);
88 tempName
[size
] = 0; /* Terminate string */
90 dl
= LockDosList(type
| LDF_READ
);
91 dl
= FindDosEntry(dl
, tempName
, type
);
94 device
= dl
->dol_Device
;
99 UnLockDosList(type
| LDF_READ
);
103 SetIoErr(ERROR_DEVICE_NOT_MOUNTED
);