NANDCheck

C Specification


#include <revolution/nand.h>

#define NAND_CHECK_HOME_INSSPACE    0x00000001
#define NAND_CHECK_HOME_INSINODE    0x00000002
#define NAND_CHECK_SYS_INSSPACE     0x00000004
#define NAND_CHECK_SYS_INSINODE     0x00000008

s32 NANDCheck( u32 fsBlock, u32 inode, u32 *answer );

Arguments

fsBlock The total number of file system blocks for the files that the application is going to create.
inode The total number of files and directories that the application is going to create.
answer Pointer to a u32 type variable that stores resource availability information.

Return Values

Returns one of the following codes:

NAND_RESULT_OK
NAND_RESULT_ALLOC_FAILED
NAND_RESULT_BUSY
NAND_RESULT_INVALID
NAND_RESULT_UNKNOWN
NAND_RESULT_FATAL_ERROR

Description

Requests the total size of the files to be created by the application and the number of files and directories to be created. It also gets information about whether there is enough space in the file system to create those files and directories. Although the NANDFreeBlocks[Async] function is available to get the available space and number of free inodes, the value that this function retrieves is for the entire file system. Since some available space and inodes must be allocated for the system, be certain to call this function and use the result when creating new files and directories in the home directory for the application. If NAND_RESULT_OK is returned because the call to this function was successful, check the value supplied in answer. If it is possible to create the requested files and directories, answer is set to zero. If it is not possible to create the requested files and directories, the bits shown in the following table are used to set the value of answer.

Macro Constants Corresponding to the Bits Set in answer Description
NAND_CHECK_HOME_INSSPACE Exceeded the maximum file size that can be created in the home directory.
NAND_CHECK_HOME_INSINODE Exceeded the maximum number of files and directories that can be created in the home directory.
NAND_CHECK_SYS_INSSPACE Attempted to use the available space reserved by the system.
NAND_CHECK_SYS_INSINODE Attempted to use the available inodes reserved by the system.

See Processing Sequence for more on the process flow when an application is launched.

This function may put the current thread to sleep. For precautions when calling similar functions, refer to Interrupts and Callback Functions.

See Also

NANDInit, NANDCheckAsync, NANDGetAvailableArea, NANDGetAvailableAreaAsync, NANDFreeBlocks, NANDFreeBlocksAsync, Interrupts and Callback Functions

Revision History

2007/09/25 Added information on the sleep status of threads.
2006/11/30 Added NAND_RESULT_ALLOC_FAILED and NAND_RESULT_BUSY codes.
2006/11/30 Deleted text about using NANDGetAvailableArea[Async] as an alternate method.
2006/10/25 Made reference to NANDGetAvailableArea[Async]. Added link to See Also.
2006/08/30 Initial version.


CONFIDENTIAL