Detabbed
[AROS.git] / rom / dos / isfilesystem.c
blob9306d19784be34000d73c8c4607d122ca1e4746f
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Check if a device is a filesystem.
6 Lang: English
7 */
9 #include <aros/debug.h>
10 #include <proto/exec.h>
11 #include <dos/dosextens.h>
12 #include <proto/utility.h>
13 #include "dos_intern.h"
14 #include <string.h>
16 /*****************************************************************************
18 NAME */
19 #include <proto/dos.h>
21 AROS_LH1(BOOL, IsFileSystem,
23 /* SYNOPSIS */
24 AROS_LHA(CONST_STRPTR, devicename, D1),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 118, Dos)
29 /* FUNCTION
30 Query the device whether it is a filesystem.
32 INPUTS
33 devicename - Name of the device to query.
35 RESULT
36 TRUE if the device is a filesystem, FALSE otherwise.
38 NOTES
39 DF0:, HD0:, ... are filesystems.
40 CON:, PIPE:, AUX:, ... are not
42 In AmigaOS if devicename contains no ":" then result
43 is always TRUE. Also volume and assign names return
44 TRUE.
46 EXAMPLE
48 BUGS
50 SEE ALSO
52 INTERNALS
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 LONG err = ERROR_OBJECT_NOT_FOUND;
59 LONG code = DOSFALSE;
60 struct DevProc *dvp = NULL;
62 /* console is never a filesystem */
63 if (Stricmp(devicename, "CONSOLE:") == 0 || Stricmp(devicename, "*") == 0 ||
64 Stricmp(devicename, "CON:") == 0 || Stricmp(devicename, "RAW:") == 0) {
65 SetIoErr(err);
66 return code;
69 if ((dvp = GetDeviceProc(devicename, dvp))) {
70 if (dvp->dvp_Port != NULL) // NIL: isn't a filesystem
71 code = dopacket0(DOSBase, NULL, dvp->dvp_Port, ACTION_IS_FILESYSTEM);
72 FreeDeviceProc(dvp);
73 } else {
74 SetIoErr(err);
77 return code;
79 AROS_LIBFUNC_EXIT
80 } /* IsFilesystem */