1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<title>NAND Sample Demo cancel</title> 9</head> 10 11<body> 12 13<H1>cancel</H1> 14 15<H2>Location</H2> 16<p> 17<CODE>$REVOLUTION_SDK_ROOT/build/demos/nanddemo</CODE> 18</p> 19 20<H2>Description</H2> 21<p> 22This shows an example of error handling with the <a href="../NANDSimpleSafeCancel.html"><CODE>NANDSimpleSafeCancel</CODE></a> function when using <CODE>NANDSimpleSafe</CODE>-type functions. 23</p> 24<p> 25The <CODE>NANDSimpleSafeOpen[Async]</CODE> and <CODE>NANDSimpleSafeClose[Async]</CODE> 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, <CODE>NANDSimpleSafe</CODE>-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 <code>NAND_RESULT_AUTHENTICATION</code> or <code>NAND_RESULT_ECC_CRIT</code> error code is encountered when using <CODE>NANDSimpleSafe</CODE>-type functions, attempt to deallocate resources by calling the <CODE>NANDSimpleSafeCancel[Async]</CODE> function from the application, as appropriate. 26</p> 27 28<h3>Process Flow</h3> 29<p> 30The basic process flow of this sample program is as follows. 31<ol> 32<li>Create a file in the home directory and write suitable data. 33<li>Open the file with the <a href="../NANDSimpleSafeOpen.html"><CODE>NANDSimpleSafeOpen</CODE></a> function. 34<li>Write data to the file with the <a href="../NANDWrite.html"><CODE>NANDWrite</CODE></a> function. 35<li>Close the file with the <a href="../NANDSimpleSafeClose.html"><CODE>NANDSimpleSafeClose</CODE></a> function. 36<li>Delete the file. 37</ol> 38</p> 39<p> 40For steps 2 and 3 in the process above, this sample program contains code that calls the <a href="../NANDSimpleSafeCancel.html"><CODE>NANDSimpleSafeCancel</CODE></a> function to recover from the error state when <code>NAND_RESULT_AUTHENTICATION</code> or <code>NAND_RESULT_ECC_CRIT</code> is returned. Please also refer to <a href="../sequence.html">Processing Sequence</a>. 41</p> 42 43<H2>See Also</H2> 44<p class="reference"> 45<a href="../NANDSimpleSafeCancel.html">NANDSimpleSafeCancel</a>, 46<a href="../NANDSimpleSafeCancelAsync.html">NANDSimpleSafeCancelAsync</a>, 47<a href="../NANDSimpleSafeOpen.html">NANDSimpleSafeOpen</a>, 48<a href="../NANDSimpleSafeOpenAsync.html">NANDSimpleSafeOpenAsync</a>, 49<a href="../NANDSimpleSafeClose.html">NANDSimpleSafeClose</a>, 50<a href="../NANDSimpleSafeCloseAsync.html">NANDSimpleSafeCloseAsync</a>, 51<a href="../sequence.html">Processing Sequence</a> 52</p> 53 54<H2>Revision History</H2> 55<p> 562007/05/09 Initial version.<br> 57</p> 58 59<hr><p>CONFIDENTIAL</p></body> 60</HTML> 61