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>VFBuffering(W)</title>
9</head>
10
11<body>
12
13<h1>VFBuffering(W)</h1>
14
15<h2>C Specification</h2>
16<dl><dd><pre><code>
17#include &lt;revolution/vf.h&gt;
18
19typedef s32	VFErr;
20
21extern VFErr VFBuffering( const char* drive, s32 mode );
22extern VFErr VFBufferingW( const VFWchar* drive, s32 mode );
23</code></pre></dd></dl>
24
25<h2>Arguments</h2>
26<p>
27<TABLE border="1" >
28  <tr>
29<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>drive</EM></STRONG></CODE></TD>
30<TD width="580">Drive name to set the write mode.</TD>
31  </tr>
32  <tr>
33<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>mode</EM></STRONG></CODE></TD>
34<TD width="580">Write or Write Back Mode<br><br>Set to <CODE>VF_WRITE_BACK_ON_SIGNIF_API</CODE> by default when VF starts.<br>When a drive is formatted, the target drive is set to the default setting, <CODE>VF_WRITE_BACK_ON_SIGNIF_API</CODE>.<br><br>
35
36	<TABLE border="1" >
37  	  <tr>
38	  <TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>VF_EJECT_SAFE_WITH_WRITE_THRU</EM></STRONG></CODE></TD>
39<TD width="300">Data is written immediately to the media if even 1 byte has been updated.</TD>
40          </tr>
41  	  <tr>
42	  <TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>VF_EJECT_SAFE_WITH_WRITE_BACK</EM></STRONG></CODE></TD>
43<TD width="300">Data is written immediately to the media if a write to FAT has been issued. Conversely, directory entries and file data are buffered to the data buffer and written back to the media during the file close process.</TD>
44          </tr>
45  	  <tr>
46	  <TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>VF_WRITE_BACK_ON_SIGNIF_API</EM></STRONG></CODE></TD>
47<TD width="300">All data is buffered and written back to the media during the file close process.</TD>
48          </tr>
49  	  <tr>
50	  <TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>VF_WRITE_BACK_CACHE</EM></STRONG></CODE></TD>
51<TD width="300">All data is buffered, but the data is not written back to the media during the file close process. To write back the data, call <a href="./VFFileSync.html"><CODE>VFFileSync</CODE></a> or <a href="./VFSync.html"><CODE>VFSync</CODE></a>.</TD>
52          </tr>
53        </TABLE>
54    </TD>
55  </tr>
56</TABLE>
57</p>
58
59<h2>Return Values</h2>
60<PRE>
61Returns 0 when successful
62Otherwise, returns <code><a href="./VFErr.html">VFErr</a></code> other than 0
63</PRE>
64
65
66<H2>Description</H2>
67<p>
68Sets the write mode and write-back mode for the FAT buffer and data buffer.<br><br> The FAT buffer is the region used internally by VF for caching the data of the FAT region when reading from or writing to FAT. The data buffer is the region used internally by VF for caching the file data and directory entry regions when reading from or writing to the file data and directory entry regions.<br>You can select whether to write data that has been updated when an API is issued immediately to the media when a directory entry has been updated with <CODE>VFCreateFile</CODE> or <CODE>VFOpenFile</CODE>, or when data has been updated with <CODE>VFReadFile</CODE> or <CODE>VFWriteFile</CODE>.<br>
69</p>
70
71<H2>Note</H2>
72<p>
73Depending on the VF internal processing, the FAT buffer and the data buffer may sometimes be swapped.<br>When this happens, write-back to the FAT buffer or data buffer will occur, regardless of the write-back setting.<br><br> When a drive that has been set to a write mode other than <CODE>VF_EJECT_SAFE_WITH_WRITE_THRU</CODE> is set to <CODE>VF_EJECT_SAFE_WITH_WRITE_THRU</CODE>, the data cached in the FAT buffer or the data buffer is written back. If the write-back process fails at this time, the write mode is not changed.<br>
74
75In addition, the state of the cache buffer is undefined because the write-back process has been interrupted.<br>If the write-back process fails, set the write mode to <CODE>VF_EJECT_SAFE_WITH_WRITE_THRU</CODE> again, and call <CODE>VFBuffering</CODE>.<br>If data cannot be written back because of some problem with the media, the write mode cannot be changed.<br><br>If a file is open in the drive specified with <CODE>drive</CODE>, do not call <CODE>VFBuffering</CODE> to change the write mode or the write-back method.<br>Operation cannot be guaranteed if you make these changes.<br>
76
77
78</p>
79
80<h2>See Also</h2>
81<p>
82<code><a href="./VFSync.html">VFSync</a></code>, <code><a href="./VFFileSync.html">VFFileSync</a></code>
83</p>
84
85<H2>Revision History</H2>
86<p>
872006/11/13 Cleaned things up<br>2006/09/29 Initial version.
88</p>
89
90
91<hr><p>CONFIDENTIAL</p></body>
92</html>
93