cancel

Location

$REVOLUTION_SDK_ROOT/build/demos/nanddemo

Description

This shows an example of error handling with the NANDSimpleSafeCancel function when using NANDSimpleSafe-type functions.

The NANDSimpleSafeOpen[Async] and NANDSimpleSafeClose[Async] functions open and close files while guaranteeing atomic file updates. However, these functions internally make multiple requests of various types (open, close, read, write, create, delete, seek, and so on) in order to implement this operation. If these requests could not be processed properly, NANDSimpleSafe-type functions will immediately return the corresponding error code to the caller. However, resources that were in use (temporary files, file descriptors, and so on) will not be deallocated. Therefore, if a NAND_RESULT_AUTHENTICATION or NAND_RESULT_ECC_CRIT error code is encountered when using NANDSimpleSafe-type functions, attempt to deallocate resources by calling the NANDSimpleSafeCancel[Async] function from the application, as appropriate.

Process Flow

The basic process flow of this sample program is as follows.

  1. Create a file in the home directory and write suitable data.
  2. Open the file with the NANDSimpleSafeOpen function.
  3. Write data to the file with the NANDWrite function.
  4. Close the file with the NANDSimpleSafeClose function.
  5. Delete the file.

For steps 2 and 3 in the process above, this sample program contains code that calls the NANDSimpleSafeCancel function to recover from the error state when NAND_RESULT_AUTHENTICATION or NAND_RESULT_ECC_CRIT is returned. Please also refer to Processing Sequence.

See Also

NANDSimpleSafeCancel, NANDSimpleSafeCancelAsync, NANDSimpleSafeOpen, NANDSimpleSafeOpenAsync, NANDSimpleSafeClose, NANDSimpleSafeCloseAsync, Processing Sequence

Revision History

2007/05/09 Initial version.


CONFIDENTIAL