2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*****************************************************************************
13 #include "nvdisk_intern.h"
15 #include <proto/dos.h>
16 #include <libraries/nonvolatile.h>
19 AROS_LH1(BOOL
, MemInfoNVD
,
23 AROS_LHA(struct NVInfo
*, nvInfo
, A0
),
27 struct Library
*, nvdBase
, 8, NVDisk
)
31 Return the information associated with the nonvolatile memory.
35 nvInfo -- information structure to be filled by this function
39 The 'nvInfo' structure will be filled with the appropriate values. In
40 case of failure, NULL will be returned.
52 3 blocks of free space are not reported as free, as it may be strange
53 for a user that queries the available storage memory, finds out that
54 free memory exists but still gets errors when using StoreNV() as the
55 memory was used for directory purposes.
59 November 2000, SDuvan -- implemented
61 ******************************************************************************/
68 if(Info(GPB(nvdBase
)->nvd_location
, &info
))
70 nvInfo
->nvi_MaxStorage
= info
.id_NumBlocks
*info
.id_BytesPerBlock
;
72 /* 3 blocks are subtracted at it may be the case a new application wants
73 to store a new item. Then the 'appName' directory will take one block,
74 the new file will take at least one block and possibly a new directory
75 block may need to be created containing the 'appName' directory */
77 if(info
.id_NumBlocks
< 3)
78 nvInfo
->nvi_FreeStorage
= 0;
81 nvInfo
->nvi_FreeStorage
=
82 (info
.id_NumBlocks
- info
.id_NumBlocksUsed
- 3)*info
.id_BytesPerBlock
;