correct copyright
[AROS.git] / rom / dos / addbuffers.c
blob17a99c35bc8678081e5923f9c9b40a94baf6c27f
1 /*
2 Copyright © 1995-2014, 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_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH2(LONG, AddBuffers,
19 /* SYNOPSIS */
20 AROS_LHA(CONST_STRPTR, devicename, D1),
21 AROS_LHA(LONG, numbuffers, D2),
23 /* LOCATION */
24 struct DosLibrary *, DOSBase, 122, Dos)
26 /* FUNCTION
27 Add or remove cache memory to/from a filesystem. The amount of memory
28 per cache buffer and the limit depends on the filesystem.
30 INPUTS
31 devicename - DOS device name (with trailing ':' and NUL terminated).
32 numbuffers - Number of buffers to add. May be negative for decreasing.
34 RESULT
35 DOSTRUE on success (IoErr() gives the actual number of buffers).
36 DOSFALSE on error (IoErr() gives the error code).
38 NOTES
39 Although some old filesystems return the new buffer count instead of
40 a success indication, a work-around for that case is built into the
41 AROS implementation of this function.
43 EXAMPLE
44 LONG res1, res2;
45 res1 = AddBuffers("DF0:", 10);
46 res2 = IoErr();
48 BUGS
50 SEE ALSO
51 IoErr()
53 INTERNALS
55 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct DevProc *dvp;
61 LONG ret, error;
63 /* get the device */
64 if ((dvp = GetDeviceProc(devicename, NULL)) == NULL)
65 return DOSFALSE;
67 /* we're only interested in real devices */
68 if (dvp->dvp_DevNode == NULL ||
69 dvp->dvp_DevNode->dol_Type != DLT_DEVICE) {
70 FreeDeviceProc(dvp);
71 SetIoErr(ERROR_DEVICE_NOT_MOUNTED);
72 return DOSFALSE;
75 ret = dopacket1(DOSBase, NULL, dvp->dvp_Port, ACTION_MORE_CACHE, numbuffers);
77 if (ret > 0)
79 error = ret;
80 ret = DOSTRUE;
82 else
83 error = IoErr();
85 FreeDeviceProc(dvp);
87 SetIoErr(error);
89 return ret;
91 AROS_LIBFUNC_EXIT
92 } /* AddBuffers */