Indentation fix, cleanup.
[AROS.git] / rom / dos / isfilesystem.c
blobf72698ada7da96906b496f0b9e98e366c98465a0
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 /* The Open() aliases '*' and 'CONSOLE:'
63 * are never filesystems
65 if (Stricmp(devicename, "*") == 0 ||
66 Stricmp(devicename, "CONSOLE:") == 0) {
67 SetIoErr(err);
68 return code;
71 /* We can't call GetDeviceProc() on CON: nor RAW:,
72 * since that will (implicitly) cause a window to
73 * open.
75 if (Stricmp(devicename, "CON:") == 0 ||
76 Stricmp(devicename, "RAW:") == 0) {
77 SetIoErr(err);
78 return code;
82 if ((dvp = GetDeviceProc(devicename, dvp))) {
83 if (dvp->dvp_Port != NULL) // No port? Not a filesystem
84 code = dopacket0(DOSBase, NULL, dvp->dvp_Port, ACTION_IS_FILESYSTEM);
85 FreeDeviceProc(dvp);
86 } else {
87 SetIoErr(err);
90 return code;
92 AROS_LIBFUNC_EXIT
93 } /* IsFilesystem */