FSRetFlag

Syntax

#include <cafe/fs.h>

/* FS_STATUS_OK, FS_STATUS_END, FS_STATUS_CANCELED and positive value can be returned always. */
#define FS_RET_NO_ERROR               0x0000

/* Flags to indicate returned error */
#define FS_RET_MAX                    0x0001
#define FS_RET_ALREADY_OPEN           0x0002
#define FS_RET_EXISTS                 0x0004
#define FS_RET_NOT_FOUND              0x0008
#define FS_RET_NOT_FILE               0x0010
#define FS_RET_NOT_DIR                0x0020
#define FS_RET_ACCESS_ERROR           0x0040
#define FS_RET_PERMISSION_ERROR       0x0080
#define FS_RET_FILE_TOO_BIG           0x0100
#define FS_RET_STORAGE_FULL           0x0200
#define FS_RET_UNSUPPORTED_CMD        0x0400
#define FS_RET_JOURNAL_FULL           0x0800

#define FS_RET_ALL_ERROR           (u32)(-1)

Elements

FS Status code to return Handling flag Descriptions
FS_STATUS_OK None. Always returned when they happened. (See Note 1)
FS_STATUS_CANCELED
FS_STATUS_END
FS_STATUS_MAX FS_RET_MAX Returned when it happens, if the flag is set.
FS_RET_ALL_ERROR covers all of these flags.
FS_STATUS_ALREADY_OPEN FS_RET_ALREADY_OPEN
FS_STATUS_EXISTS FS_RET_EXISTS
FS_STATUS_NOT_FOUND FS_RET_NOT_FOUND
FS_STATUS_NOT_FILE FS_RET_NOT_FILE
FS_STATUS_NOT_DIR FS_RET_NOT_DIR
FS_STATUS_ACCESS_ERROR FS_RET_ACCESS_ERROR
FS_STATUS_PERMISSION_ERROR FS_RET_PERMISSION_ERROR
FS_STATUS_FILE_TOO_BIG FS_RET_FILE_TOO_BIG
FS_STATUS_STORAGE_FULL FS_RET_STORAGE_FULL
FS_STATUS_JOURNAL_FULL FS_RET_JOURNAL_FULL
FS_STATUS_UNSUPPORTED_CMD FS_RET_UNSUPPORTED_CMD
FS_STATUS_MEDIA_ERROR None. Always returned when it happens for a manually mounted volume (See Note 2).
FS_STATUS_FATAL_ERROR None. Always returned when it happens in an async API call.
Never returned in a sync API call.

Description

Flags for the auto error handling feature. The flags are used to choose which errors are returned from the function. The table above lists the FS status codes and their corresponding flags that indicate an error was returned.

For functions which have an error handling flag as an argument, the application can control the attitude of the FS layer when an error occurs by specifying these flags.

FSRetFlag corresponds to one of FSStatus codes. Applications can determine the behavior of the function for each of the status codes whether the function returns it so the application can handle it manually, or automatically puts FSClient into a fatal state and does not return.

When FSClient goes to a fatal state, the FSVolState is set to FS_VOLSTATE_FATAL. The function then behaves as one of following:

Flags can be bitwise-ORed (|) together. The application can also specify the wildcards FS_RET_ALL_ERROR (equivalent to specifying all flags = expecting manual error handling as much as possible ) or FS_RET_NO_ERROR (equivalent to specifying no flags = expecting the command will always succeed). These wildcards are effective only on those status codes that can be controlled by individual bitwise flags.

Note 1: Non-error status codes

Regardless of specified flag (even if the application specified FS_RET_NO_ERROR), FS_STATUS_CANCELED and FS_STATUS_END can be returned. The state of the client will not be changed by these results.

Note 2: Media errors

When a media error occurs, the attitude of FS layer branches according to whether the device is auto-mounted or manually-mounted:

Therefore, there are no flags which correspond to these media errors. Their behavior depends on the type of accessed volume (auto-mounted or manually mounted), regardless of the flags specified. See also Auto Error Handling in the File System Overview page.

Note 3: Invalid parameter errors

When invalid parameter errors (specified client, command block, path, buffer address, buffer alignment, handle, or any other argument was apparently invalid) occurred, always it is considered as a coding error and the state of the client will change to FS_VOLSTATE_FATAL. There are no corresponding FSStatus. Use FSGetLastError to find reasons for this type of error.

See Also

Types / Structures
File System Overview
FS Demos
FSStatus
FSVolumeState

Revision History

2013/05/08 Automated cleanup pass.
2012/09/21 Change status name from FS_STATUS_CANCELLED to FS_STATUS_CANCELED.
2012/07/30 Removed information about FSA.
2012/07/20 Readability and correctness cleanup.
2012/05/16 Added description.
2012/03/30 Removed FS_RET_CANCELLED. Updated values.
2011/12/13 Initial version.


CONFIDENTIAL