Fixed missing fprintf argument.
[AROS.git] / rom / dos / addbuffers.c
blob5354b736bd26849b294b174f250bf08c703ff6cd
1 /*
2 Copyright © 1995-2001, 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(BOOL, 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
55 AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
57 BOOL success = FALSE;
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)
70 return FALSE;
72 iofs.io_Union.io_MORE_CACHE.io_NumBuffers = numbuffers;
74 /* Send the request. */
75 DosDoIO(&iofs.IOFS);
77 /* Set error code */
78 if(iofs.io_DosError == 0)
80 /* IoErr() gives the number of buffers! */
81 SetIoErr(iofs.io_Union.io_MORE_CACHE.io_NumBuffers);
82 success = TRUE;
84 else
85 SetIoErr(iofs.io_DosError);
87 return success;
89 AROS_LIBFUNC_EXIT
90 } /* AddBuffers */