Corrected invalid characters.
[tangerine.git] / rom / dos / format.c
blobd0a15c616b866e9813594243ca490e72a6c004dd
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Format a device.
6 */
7 #include <proto/exec.h>
8 #include <dos/dosextens.h>
9 #include <dos/filesystem.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH3(BOOL, Format,
19 /* SYNOPSIS */
20 AROS_LHA(CONST_STRPTR, devicename, D1),
21 AROS_LHA(CONST_STRPTR, volumename, D2),
22 AROS_LHA(ULONG, dostype, D3),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 119, Dos)
27 /* FUNCTION
28 Initialise a filesystem for use by the system. This instructs
29 a filesystem to write out the data that it uses to describe the
30 device.
32 The device should already have been formatted.
34 INPUTS
35 devicename - Name of the device to format.
36 volumename - The name you wish the volume to be called.
37 dostype - The DOS type you wish on the disk.
39 RESULT
40 != 0 if the format was successful, 0 otherwise.
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
50 INTERNALS
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct DevProc *dvp;
57 LONG err;
59 /* Get space for I/O request. Use stackspace for now. */
60 struct IOFileSys iofs;
62 /* Prepare I/O request. */
63 InitIOFS(&iofs, FSA_FORMAT, DOSBase);
64 iofs.io_Union.io_FORMAT.io_VolumeName = volumename;
65 iofs.io_Union.io_FORMAT.io_DosType = dostype;
67 /* get the device */
68 if ((dvp = GetDeviceProc(devicename, NULL)) == NULL)
69 return DOSFALSE;
71 /* we're only interested in real devices */
72 if (dvp->dvp_DevNode->dol_Type != DLT_DEVICE) {
73 FreeDeviceProc(dvp);
74 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
75 return DOSFALSE;
78 err = DoIOFS(&iofs, dvp, NULL, DOSBase);
80 FreeDeviceProc(dvp);
82 return err == 0 ? TRUE : FALSE;
84 AROS_LIBFUNC_EXIT
85 } /* Format */