2 Copyright © 1995-2008, 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 void InitIOFS(struct IOFileSys
*iofs
, ULONG type
,
21 struct DosLibrary
*DOSBase
)
23 struct Process
*me
= (struct Process
*)FindTask(NULL
);
25 iofs
->IOFS
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
26 iofs
->IOFS
.io_Message
.mn_ReplyPort
= &me
->pr_MsgPort
;
27 iofs
->IOFS
.io_Message
.mn_Length
= sizeof(struct IOFileSys
);
28 iofs
->IOFS
.io_Command
= type
;
29 iofs
->IOFS
.io_Flags
= 0;
32 CONST_STRPTR
StripVolume(CONST_STRPTR name
) {
33 const char *path
= strchr(name
, ':');
41 LONG
DoIOFS(struct IOFileSys
*iofs
, struct DevProc
*dvp
, CONST_STRPTR name
,
42 struct DosLibrary
*DOSBase
) {
46 if ((dvp
= GetDeviceProc(name
, NULL
)) == NULL
)
52 iofs
->IOFS
.io_Device
= (struct Device
*) dvp
->dvp_Port
;
54 if (dvp
->dvp_Lock
!= NULL
)
55 iofs
->IOFS
.io_Unit
= ((struct FileHandle
*) BADDR(dvp
->dvp_Lock
))->fh_Unit
;
57 iofs
->IOFS
.io_Unit
= dvp
->dvp_DevNode
->dol_Ext
.dol_AROS
.dol_Unit
;
60 iofs
->io_Union
.io_NamedFile
.io_Filename
= StripVolume(name
);
62 DosDoIO((struct IORequest
*)iofs
);
64 SetIoErr(iofs
->io_DosError
);
69 return iofs
->io_DosError
;