use same location as .configured, etc, to store .files-touched
[AROS.git] / compiler / clib / __filesystem_support.c
blobe8c3ec45343315241459d4dfd91dc9db91225653
1 /*
2 Copyright © 2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: dos support functions for internal use
6 */
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, ':');
17 if (path != NULL)
18 path++;
19 else
20 path = name;
21 return path;
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) {
40 BOOL freedvp = FALSE;
42 if (dvp == NULL) {
43 if ((dvp = GetDeviceProc(name, NULL)) == NULL)
44 return IoErr();
46 freedvp = TRUE;
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;
53 else
54 iofs->IOFS.io_Unit = dvp->dvp_DevNode->dol_Ext.dol_AROS.dol_Unit;
56 if (name != NULL)
57 iofs->io_Union.io_NamedFile.io_Filename = StripVolume(name);
59 DoIO((struct IORequest *)iofs);
61 if (freedvp)
62 FreeDeviceProc(dvp);
64 SetIoErr(iofs->io_DosError);
66 return iofs->io_DosError;
69 #endif