2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
7 #include <proto/exec.h>
8 #include <dos/dosextens.h>
9 #include <dos/filesystem.h>
10 #include "dos_intern.h"
12 /*****************************************************************************
15 #include <proto/dos.h>
17 AROS_LH3(BOOL
, Format
,
20 AROS_LHA(CONST_STRPTR
, devicename
, D1
),
21 AROS_LHA(CONST_STRPTR
, volumename
, D2
),
22 AROS_LHA(ULONG
, dostype
, D3
),
25 struct DosLibrary
*, DOSBase
, 119, Dos
)
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
32 The device should already have been formatted.
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.
40 != 0 if the format was successful, 0 otherwise.
52 *****************************************************************************/
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
;
68 if ((dvp
= GetDeviceProc(devicename
, NULL
)) == NULL
)
71 /* we're only interested in real devices */
72 if (dvp
->dvp_DevNode
->dol_Type
!= DLT_DEVICE
) {
74 SetIoErr(ERROR_DEVICE_NOT_MOUNTED
);
78 err
= DoIOFS(&iofs
, dvp
, NULL
, DOSBase
);
82 return err
== 0 ? TRUE
: FALSE
;