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>NANDSimpleSafeOpenAsync</title>
9</head>
10
11<body>
12
13<h1>NANDSimpleSafeOpenAsync</h1>
14
15<h2>Syntax</h2>
16<dl><dd><pre class="construction">
17#include &lt;revolution/nand.h&gt;
18
19#define NAND_ACCESS_READ       0x01
20#define NAND_ACCESS_WRITE      0x02
21#define NAND_ACCESS_RW         (NAND_ACCESS_READ | NAND_ACCESS_WRITE)
22
23typedef void (*NANDCallback)( s32 result, NANDCommandBlock *block );
24
25s32 NANDSimpleSafeOpenAsync(const char *path, NANDFileInfo *info, u8 accType, void *buf, u32 length, NANDCallback cb, NANDCommandBlock *block);
26</pre></dd></dl>
27
28<h2>Arguments</h2>
29<p>
30<TABLE class="arguments" border="1" >
31  <tr>
32<TH>path</TH>
33<TD>Name of the file to open.</TD>
34  </tr>
35  <tr>
36<TH>info</TH>
37<TD>Pointer to a <CODE>NANDFileInfo</CODE> structure.</TD>
38  </tr>
39  <tr>
40<TH>accType</TH>
41<TD>Access type. Specifies either <code>NAND_ACCESS_READ</code>, <code>NAND_ACCESS_WRITE</code> or <code>NAND_ACCESS_RW</code>.</TD>
42  </tr>
43  <tr>
44<TH>buf</TH>
45<TD>Specifies the leading address of the buffer to be used when copying files. The buffer must be 32-byte aligned.</TD>
46  </tr>
47  <tr>
48<TH>length</TH>
49<TD>Specifies the size of the buffer to be used when copying files. <font color="ff0000">The size must be a multiple of <code>NAND_FSBLOCK_SIZE</code> (16KB).</font></TD>
50  </tr>
51  <tr>
52<TH>cb</TH>
53<TD>Callback function to call when this function completes processing.</TD>
54  </tr>
55  <tr>
56<TH>block</TH>
57<TD>Command block structure to be passed to the callback function.</TD>
58  </tr>
59</TABLE>
60</p>
61
62<h2>Return Values</h2>
63<p>
64The result codes that <code>NANDSimpleSafeOpenAsync</code> can return are listed below. When the request begins normally, returns <CODE>NAND_RESULT_OK</CODE>.
65<p>
66<code>
67NAND_RESULT_OK<br>
68NAND_RESULT_ACCESS<br>
69NAND_RESULT_ALLOC_FAILED<br>
70NAND_RESULT_BUSY<br>
71NAND_RESULT_INVALID<br>
72NAND_RESULT_FATAL_ERROR<br>
73</code>
74</p>
75<p>
76The result codes that may be passed to the callback function are listed below.
77</p>
78<p>
79<code>
80NAND_RESULT_OK<br>
81NAND_RESULT_ACCESS<br>
82NAND_RESULT_ALLOC_FAILED<br>
83NAND_RESULT_AUTHENTICATION<br>
84NAND_RESULT_BUSY<br>
85NAND_RESULT_CORRUPT<br>
86NAND_RESULT_ECC_CRIT<br>
87NAND_RESULT_EXISTS<br>
88NAND_RESULT_INVALID<br>
89NAND_RESULT_MAXBLOCKS<br>
90NAND_RESULT_MAXFD<br>
91NAND_RESULT_MAXFILES<br>
92NAND_RESULT_NOEXISTS<br>
93NAND_RESULT_UNKNOWN<br>
94NAND_RESULT_FATAL_ERROR<br>
95</code>
96</p>
97</p>
98
99<H2>Description</H2>
100<p>
101Asynchronously opens a file in a manner that guarantees the atomic nature of file updates. The file opened using this function must be closed using either the <code><a href="./NANDSimpleSafeClose.html">NANDSimpleSafeClose</a></code> or the <code><a href="./NANDSimpleSafeCloseAsync.html">NANDSimpleSafeCloseAsync</a></code> function. Appropriate permissions (both read and write) must be set for the parent directory of the file to which <CODE>NANDSimpleSafe</code>-related functions are applied.
102</p>
103<p>
104<font color="ff0000">This function cannot be used to open more than one file that has the same file name (for example, You cannot open <code>~/userA/save.dat</code> and <code>~/userB/save.dat</code> simultaneously (<code>NAND_RESULT_EXISTS</code> will be returned).</font>
105</p>
106<p>
107<font color="ff0000">The callback specified with this function may 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<p>
110When <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.
111</p>
112
113<h2>See Also</h2>
114<p class="reference">
115<a href="./NANDSimpleSafeOpen.html">NANDSimpleSafeOpen</a>,
116<a href="./NANDSimpleSafeClose.html">NANDSimpleSafeClose</a>,
117<a href="./NANDSimpleSafeCloseAsync.html">NANDSimpleSafeCloseAsync</a>,
118<a href="./NANDSimpleSafeCancel.html">NANDSimpleSafeCancel</a>,
119<a href="./NANDSimpleSafeCancelAsync.html">NANDSimpleSafeCancelAsync</a>
120</p>
121
122<H2>Revision History</H2>
123<p>
1242008/08/01 Added an explanation related to FAT updates.<br> 2008/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 Initial version.<BR>
125</p>
126
127<hr><p>CONFIDENTIAL</p></body>
128</html>
129