Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / inhibit.c
bloba4dae3db46a8109bfcf5fe2f4b9ef3ffe560d69b
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
5 #include <proto/exec.h>
7 #include "dos_intern.h"
9 /*****************************************************************************
11 NAME */
12 #include <proto/dos.h>
14 AROS_LH2(LONG, Inhibit,
16 /* SYNOPSIS */
17 AROS_LHA(CONST_STRPTR, name, D1),
18 AROS_LHA(LONG, onoff, D2),
20 /* LOCATION */
21 struct DosLibrary *, DOSBase, 121, Dos)
23 /* FUNCTION
25 Stop a filesystem from being used.
27 INPUTS
29 name -- Name of the device to inhibit (including a ':')
30 onoff -- Specify whether to inhinit (DOSTRUE) or uninhibit (DOSFALSE)
31 the device
33 RESULT
35 A boolean telling whether the action was carried out.
37 NOTES
39 After uninhibiting a device anything might have happened like the disk
40 in the drive was removed.
42 EXAMPLE
44 BUGS
46 SEE ALSO
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct IOFileSys iofs;
55 struct DevProc *dvp;
56 LONG err;
58 InitIOFS(&iofs, FSA_INHIBIT, DOSBase);
59 iofs.io_Union.io_INHIBIT.io_Inhibit = onoff == DOSTRUE ? TRUE : FALSE;
61 /* get the device */
62 if ((dvp = GetDeviceProc(name, NULL)) == NULL)
63 return DOSFALSE;
65 /* we're only interested in real devices */
66 if (dvp->dvp_DevNode->dol_Type != DLT_DEVICE) {
67 FreeDeviceProc(dvp);
68 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
69 return DOSFALSE;
72 err = DoIOFS(&iofs, dvp, NULL, DOSBase);
74 FreeDeviceProc(dvp);
76 return err == 0 ? DOSTRUE : DOSFALSE;
78 AROS_LIBFUNC_EXIT
79 } /* Inhibit */