Map menu key to right amiga to allow clipboard operations on keyboards without right...
[AROS.git] / rom / dos / addbuffers.c
blobf773b4ac538e453e639713c9a40deb75231046c4
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Add or remove cache memory from a filesystem.
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include <dos/dosextens.h>
10 #include <dos/filesystem.h>
11 #include "dos_intern.h"
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH2(LONG, AddBuffers,
20 /* SYNOPSIS */
21 AROS_LHA(CONST_STRPTR, devicename, D1),
22 AROS_LHA(LONG, numbuffers, D2),
24 /* LOCATION */
25 struct DosLibrary *, DOSBase, 122, Dos)
27 /* FUNCTION
28 Add or remove cache memory from a filesystem.
30 INPUTS
31 devicename -- NUL terminated dos device name.
32 numbuffers -- Number of buffers to add. May be negative.
34 RESULT
35 != 0 on success (IoErr() gives the actual number of buffers),
36 0 else (IoErr() gives the error code).
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 The error value in case of a filesystem error will be reported in
49 the io_MORE_CACHE.io_NumBuffers field.
51 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct DevProc *dvp;
57 LONG err;
59 /* Use stackspace for IO request. */
60 struct IOFileSys iofs;
62 /* setup */
63 InitIOFS(&iofs, FSA_MORE_CACHE, DOSBase);
64 iofs.io_Union.io_MORE_CACHE.io_NumBuffers = numbuffers;
66 /* get the device */
67 if ((dvp = GetDeviceProc(devicename, NULL)) == NULL)
68 return DOSFALSE;
70 /* we're only interested in real devices */
71 if (dvp->dvp_DevNode->dol_Type != DLT_DEVICE) {
72 FreeDeviceProc(dvp);
73 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
74 return DOSFALSE;
77 err = DoIOFS(&iofs, dvp, NULL, DOSBase);
79 FreeDeviceProc(dvp);
81 if (err != 0)
82 return DOSFALSE;
84 /* caller expects the new number of buffers in IoErr() */
85 SetIoErr(iofs.io_Union.io_MORE_CACHE.io_NumBuffers);
86 return DOSTRUE;
88 AROS_LIBFUNC_EXIT
89 } /* AddBuffers */