2 Copyright © 2009, The AROS Development Team. All rights reserved.
5 Desc: dos support functions for internal use
8 #include <aros/debug.h>
10 #include <dos/filesystem.h>
11 #include <proto/dos.h>
13 #include "__filesystem_support.h"
15 CONST_STRPTR
StripVolume(CONST_STRPTR name
) {
16 const char *path
= strchr(name
, ':');
24 #ifndef AROS_DOS_PACKETS
26 void InitIOFS(struct IOFileSys
*iofs
, ULONG type
,
27 struct DosLibrary
*DOSBase
)
29 struct Process
*me
= (struct Process
*)FindTask(NULL
);
31 iofs
->IOFS
.io_Message
.mn_Node
.ln_Type
= NT_REPLYMSG
;
32 iofs
->IOFS
.io_Message
.mn_ReplyPort
= &me
->pr_MsgPort
;
33 iofs
->IOFS
.io_Message
.mn_Length
= sizeof(struct IOFileSys
);
34 iofs
->IOFS
.io_Command
= type
;
35 iofs
->IOFS
.io_Flags
= 0;
38 LONG
DoIOFS(struct IOFileSys
*iofs
, struct DevProc
*dvp
, CONST_STRPTR name
,
39 struct DosLibrary
*DOSBase
) {
43 if ((dvp
= GetDeviceProc(name
, NULL
)) == NULL
)
49 iofs
->IOFS
.io_Device
= (struct Device
*) dvp
->dvp_Port
;
51 if (dvp
->dvp_Lock
!= BNULL
)
52 iofs
->IOFS
.io_Unit
= ((struct FileHandle
*) BADDR(dvp
->dvp_Lock
))->fh_Unit
;
54 iofs
->IOFS
.io_Unit
= dvp
->dvp_DevNode
->dol_Ext
.dol_AROS
.dol_Unit
;
57 iofs
->io_Union
.io_NamedFile
.io_Filename
= StripVolume(name
);
59 DoIO((struct IORequest
*)iofs
);
64 SetIoErr(iofs
->io_DosError
);
66 return iofs
->io_DosError
;