NANDReadDirAsync

C Specification


#include <revolution/nand.h>

#define NAND_MAX_NAME          12

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

s32 NANDReadDirAsync( const char *dirName, char *nameList, u32 *num, NANDCallback cb, NANDCommandBlock *block );

Arguments

dirName Directory name.
nameList Buffer start address for storing the file and directory list that is contained in the specified directory. This buffer must be 32-byte aligned. If NULL is specified, the list is not stored.
num If nameList is NULL, the number of files/directories contained in dirName will be stored in *num. If a (non-NULL) buffer address is given in nameList, the file name/directory name will be written to the nameList buffer as an upper limit to the value of *num, and the number of files/directories that were actually obtained from dirName will be stored in *num.
cb Callback function to call when this function completes processing.
block Command block structure to be passed to the callback function.

Return Values

Returns NAND_RESULT_OK when the request begins normally.

NAND_RESULT_OK
NAND_RESULT_ACCESS
NAND_RESULT_ALLOC_FAILED
NAND_RESULT_BUSY
NAND_RESULT_INVALID
NAND_RESULT_NOEXISTS
NAND_RESULT_UNKNOWN
NAND_RESULT_FATAL_ERROR

Description

Asynchronously gets a list of files and directories contained in the specified directory. If the list size is unknown, retrieve the list using the following steps.

  1. Call this function with NULL specified as the second argument. The number of elements in the list will be written to the memory region that num points to.
  2. Secure a memory region whose size is = (Number of elements) x (NAND_MAX_NAME+1) rounded up to a multiple of 32 bytes.
  3. Call this function again with the allocated memory start address as the second argument.
  4. The number of elements of the list that was retrieved is stored in num (this value may be less than the value in the first call to this function), and the file and directory list with a null character separator is stored in the allocated memory.

NAND_RESULT_BUSY is returned and this function call is denied when the queue for accepting requests inside the library is full.

See Also

NANDReadDir

Revision History

2007/06/xx The description of the third argument was not sufficient, so it was revised.
2006/09/07 Added text about securing memory of a size rounded up to a multiple of 32 bytes.
2006/06/16 Initial version.