Support rastport clipping rectangle for layerless rastports
[tangerine.git] / rom / dos / format.c
blob0ae27c325c9048be9eb85b2fcc07a56ca74e3afe
1 /*
2 Copyright © 1995-2004, 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
55 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
57 BOOL success = 0;
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);
65 iofs.IOFS.io_Device = GetDevice(devicename, &iofs.IOFS.io_Unit,
66 DOSBase);
68 if (iofs.IOFS.io_Device == NULL)
70 return 0;
73 iofs.io_Union.io_FORMAT.io_VolumeName = volumename;
74 iofs.io_Union.io_FORMAT.io_DosType = dostype;
76 /* Send the request. */
77 DosDoIO(&iofs.IOFS);
79 /* Set error code */
80 if (iofs.io_DosError == 0)
82 success = 1;
84 else
86 SetIoErr(iofs.io_DosError);
89 return success;
91 AROS_LIBFUNC_EXIT
92 } /* Format */