2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
5 Desc: Add or remove cache memory from a filesystem.
8 #include <proto/exec.h>
9 #include <dos/dosextens.h>
10 #include <dos/filesystem.h>
11 #include "dos_intern.h"
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH2(BOOL
, AddBuffers
,
21 AROS_LHA(CONST_STRPTR
, devicename
, D1
),
22 AROS_LHA(LONG
, numbuffers
, D2
),
25 struct DosLibrary
*, DOSBase
, 122, Dos
)
28 Add or remove cache memory from a filesystem.
31 devicename -- NUL terminated dos device name.
32 numbuffers -- Number of buffers to add. May be negative.
35 != 0 on success (IoErr() gives the actual number of buffers),
36 0 else (IoErr() gives the error code).
48 The error value in case of a filesystem error will be reported in
49 the io_MORE_CACHE.io_NumBuffers field.
51 *****************************************************************************/
55 AROS_LIBBASE_EXT_DECL(struct DosLibrary
*,DOSBase
)
59 /* Use stackspace for IO request. */
60 struct IOFileSys iofs
;
62 InitIOFS(&iofs
, FSA_MORE_CACHE
, DOSBase
);
64 /* Now the specific intialization */
66 /* Get the device corresponding to 'devicename' */
67 iofs
.IOFS
.io_Device
= GetDevice(devicename
, &iofs
.IOFS
.io_Unit
, DOSBase
);
69 if(iofs
.IOFS
.io_Device
== NULL
)
72 iofs
.io_Union
.io_MORE_CACHE
.io_NumBuffers
= numbuffers
;
74 /* Send the request. */
78 if(iofs
.io_DosError
== 0)
80 /* IoErr() gives the number of buffers! */
81 SetIoErr(iofs
.io_Union
.io_MORE_CACHE
.io_NumBuffers
);
85 SetIoErr(iofs
.io_DosError
);