2 Copyright © 1995-2007, 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(LONG
, 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 *****************************************************************************/
59 /* Use stackspace for IO request. */
60 struct IOFileSys iofs
;
63 InitIOFS(&iofs
, FSA_MORE_CACHE
, DOSBase
);
64 iofs
.io_Union
.io_MORE_CACHE
.io_NumBuffers
= numbuffers
;
67 if ((dvp
= GetDeviceProc(devicename
, NULL
)) == NULL
)
70 /* we're only interested in real devices */
71 if (dvp
->dvp_DevNode
->dol_Type
!= DLT_DEVICE
) {
73 SetIoErr(ERROR_DEVICE_NOT_MOUNTED
);
77 err
= DoIOFS(&iofs
, dvp
, NULL
, DOSBase
);
84 /* caller expects the new number of buffers in IoErr() */
85 SetIoErr(iofs
.io_Union
.io_MORE_CACHE
.io_NumBuffers
);