NANDCheckAsync

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

typedef void (*NANDCallback)( s32 result, NANDCommandBlock *block );

s32 NANDCheckAsync( u32 fsBlock, u32 inode, u32 *answer, NANDCallback cb, NANDCommandBlock *block );

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.
cb Callback function to call when this function completes processing.
block Command block structure to be passed to the callback function.

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 files to be created by the application, the number of files and directories to be created, and asynchronously determines 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 i-nodes 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 received by the callback function and 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.

See Also

NANDInit, NANDCheck, NANDGetAvailableArea, NANDGetAvailableAreaAsync, NANDFreeBlocks, NANDFreeBlocksAsync

Revision History

2006/11/30 Deleted text about using NANDGetAvailableArea[Async] as an alternate method.
2006/10/25 Expanded statement to include NANDGetAvailableArea[Async]. Added links to See Also.
2006/08/30 Initial version.