1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html xmlns="http://www.w3.org/1999/xhtml"> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> 5<meta http-equiv="Content-Style-Type" content="text/css" /> 6<title>FS_SetSeekCache</title> 7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 8</head> 9<body> 10 11<h1>FS_SetSeekCache <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1> 12<h2>Syntax</h2> 13<pre><code> 14#include <nitro/fs.h> 15 16BOOL FS_SetSeekCache(<A href="../fs_file_type.html">FSFile</a> *file, void* buf, u32 bufsize); 17</code></pre> 18 19<h2>Arguments</h2> 20<table style="width:100%"> 21<tbody> 22<tr> 23<td style="width:13%"><CODE>file</CODE></td> 24<td style="width:87%">An already open file.<br /><span style="color:Red">For more details, see the Notes section.</span></td> 25</tr> 26<tr> 27<td style="width:13%"><CODE>buf</CODE></td> 28<td style="width:87%">Buffer to be used as the seek cache.<br />Use of the cache buffer already configured is cancelled if NULL is specified.<br /><span style="color:Red">For details on the conditions that apply to the argument, see the Notes section.</span></td> 29</tr> 30<tr> 31<td style="width:13%">bufsize</td> 32<td style="width:87%">Buffer size.<br />Use the <A><CODE>FS_GetSeekCacheSize</CODE></A> function to get the required size for the seek cache. If the size is small, the library will build the largest cache it can within the size provided.</td> 33</tr> 34</tbody> 35</table> 36 37<h2>Return Values</h2> 38<p>Returns TRUE if the process succeeds.<br /> Returns FALSE in the following situations.</p> 39<ul> 40<li>The specified buffer is not located in main memory</li> 41<li>The buffer region becomes 0 after the two ends of the specified buffer are cropped to a 32-byte cache line boundary</li> 42</ul> 43 44<h2>Description</h2> 45<p>Sets the seek cache buffer.<br />With archives like <a href="../archive_nand_spec.html">NAND archives</a> or <a href="../archive_sdmc_spec.html">SD Card archives</a> that use FAT as the internal format, operations that seek to the end of the file and operations that seek in the reverse direction may require a significant execution cost. If you know that you will be making frequent use of seek operations on read-only files, you can improve the seek speed by using this function.</p> 46<p>The buffer set with this function will be managed by the library until either the file is closed or NULL is specified to explicitly cancel use of the file.</p> 47<p>This function uses only the cropped region of the specified buffer that remains after the start and end have been aligned with the cache line boundary. The buffer size retrieved by the <CODE><a href="FS_GetSeekCacheSize.html">FS_GetSeekCacheSize</a></CODE> function contains enough space for addresses of any length.</p> 48 49<h2>Note</h2> 50<a name="note" /> 51<ul><span style="color:Red"> 52<li>The file being specified must be opened in read-only mode.</li> 53<li>The seek cache being specified must be a buffer in main memory that is aligned to a boundary that is an integer multiple of 4 bytes.</li> 54</span></ul> 55 56<h2>See Also</h2> 57<p><code><a href="FS_SeekFile.html">FS_SeekFile</a><BR> <a href="FS_GetSeekCacheSize.html">FS_GetSeekCacheSize</a></code></p> 58 59<h2>Revision History</h2> 60<p> 612009/02/05 Explained the buffer's alignment to cache line boundary.<br />2008/07/01 Noted that the file must be opened in read-only mode.<br />2008/06/26 Initial version.<br /> 62</p> 63<hr><p>CONFIDENTIAL</p></body> 64</html> 65