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>NANDSafeOpenAsync</title> 9</head> 10 11<body> 12 13<h1>NANDSafeOpenAsync</h1> 14<p> 15<font color="ff0000">Use of this function is not recommended. If possible, consider using <CODE>NANDSimpleSafe</CODE>-related functions.</font> 16</p> 17 18<h2>Syntax</h2> 19<dl><dd><pre class="construction"> 20#include <revolution/nand.h> 21 22#define NAND_ACCESS_READ 0x01 23#define NAND_ACCESS_WRITE 0x02 24#define NAND_ACCESS_RW (NAND_ACCESS_READ | NAND_ACCESS_WRITE) 25 26typedef void (*NANDCallback)( s32 result, NANDCommandBlock *block ); 27 28s32 NANDSafeOpenAsync(const char *path, NANDFileInfo *info, u8 accType, void *buf, u32 length, NANDCallback cb, NANDCommandBlock *block); 29</pre></dd></dl> 30 31<h2>Arguments</h2> 32<p> 33<TABLE class="arguments" border="1" > 34 <tr> 35<TH><code><EM><STRONG>path</STRONG></EM></code></TH> 36<TD>File name to open.</TD> 37 </tr> 38 <tr> 39<TH>info</TH> 40<TD>Pointer to a <CODE>NANDFileInfo</CODE> structure</TD> 41 </tr> 42 <tr> 43<TH>accType</TH> 44<TD>Access type. Specifies either <code>NAND_ACCESS_READ</code>, <code>NAND_ACCESS_WRITE</code> or <CODE>NAND_ACCESS_RW</CODE>.</TD> 45 </tr> 46 <tr> 47<TH>buf</TH> 48<TD>Specifies the leading address of the buffer to be used when copying files. The buffer must be 32-byte aligned.</TD> 49 </tr> 50 <tr> 51<TH>length</TH> 52<TD>Specifies the size of the buffer to be used when copying files. Buffer size must be a multiple of 32 bytes. We recommend a size between 4 KB and 16 KB.</TD> 53 </tr> 54 <tr> 55<TH>cb</TH> 56<TD>Callback function to call when this function completes processing.</TD> 57 </tr> 58 <tr> 59<TH>block</TH> 60<TD>Command block structure to be passed to the callback function.</TD> 61 </tr> 62</TABLE> 63</p> 64 65 66<h2>Return Values</h2> 67<p> 68The result codes that can be returned by <code>NANDSafeOpenAsync</code> are listed below. Returns <CODE>NAND_RESULT_OK</CODE> when the request begins normally. 69<p> 70<code> 71NAND_RESULT_OK<br> 72NAND_RESULT_ACCESS<br> 73NAND_RESULT_ALLOC_FAILED<br> 74NAND_RESULT_BUSY<br> 75NAND_RESULT_INVALID<br> 76NAND_RESULT_FATAL_ERROR<br> 77</code> 78</p> 79<p> 80The result codes that may be passed to the callback function are listed below. 81</p> 82<p> 83<code> 84NAND_RESULT_OK<br> 85NAND_RESULT_ACCESS<br> 86NAND_RESULT_ALLOC_FAILED<br> 87NAND_RESULT_AUTHENTICATION<br> 88NAND_RESULT_BUSY<br> 89NAND_RESULT_CORRUPT<br> 90NAND_RESULT_ECC_CRIT<br> 91NAND_RESULT_INVALID<br> 92NAND_RESULT_MAXBLOCKS<br> 93NAND_RESULT_MAXFD<br> 94NAND_RESULT_MAXFILES<br> 95NAND_RESULT_NOEXISTS<br> 96NAND_RESULT_UNKNOWN<br> 97NAND_RESULT_FATAL_ERROR<br> 98</code> 99</p> 100</p> 101 102<H2>Description</H2> 103<p> 104Asynchronously opens a file in a manner that guarantees the atomic nature of file updates. The file opened using this function must be closed using <code><a href="./NANDSafeClose.html">NANDSafeClose</a></code> or <code><a href="./NANDSafeCloseAsync.html">NANDSafeCloseAsync</a></code>. Appropriate permissions (both read and write) must be set for the parent directory of the file to which <CODE>NANDSafe</CODE>-type functions are applied. <code>NAND_RESULT_BUSY</code> is returned and this function call is denied when the queue for accepting requests inside the library is full. 105</p> 106<p> 107<font color="ff0000">Unlike a large number of asynchronous NAND functions, the callback specified with this function might receive <CODE>NAND_RESULT_ALLOC_FAILED</CODE> or <CODE>NAND_RESULT_BUSY</CODE> when <CODE>NAND_ACCESS_WRITE</CODE> or <CODE>NAND_ACCESS_RW</CODE> is specified for <CODE>accType</CODE>.</font> 108</p> 109 110<p> 111When <code>NAND_ACCESS_WRITE</code> or <code>NAND_ACCESS_RW</code> is specified for <code>accType</code>, this function will update the FAT in Wii console NAND memory. 112</p> 113 114<h2>See Also</h2> 115<p class="reference"> 116<a href="./NANDSafeOpen.html">NANDSafeOpen</a>, 117<a href="./NANDSafeClose.html">NANDSafeClose</a>, 118<a href="./NANDSafeCloseAsync.html">NANDSafeCloseAsync</a> 119</p> 120 121<H2>Revision History</H2> 122<p> 1232008/07/29 Added information regarding the result code that the callback function might receive.<br>2008/05/13 Described the result codes passed to the callback function.<br>2007/05/09 Noted that the use of this function is not recommended.<br>2006/09/19 Added information regarding the result code that the callback function may receive.<br>2006/09/08 Added a requirement for the parent directory permissions.<br>2006/08/15 Initial version.<BR> 124</p> 125 126<hr><p>CONFIDENTIAL</p></body> 127</html> 128