]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/documents/doc/expand.html
Import fatfs R0.13b
[z180-stamp.git] / fatfs / documents / doc / expand.html
similarity index 76%
rename from fatfs/doc/en/expand.html
rename to fatfs/documents/doc/expand.html
index 0715635006dbb08a2ce46cc5257aa6769b4a2303..d64f483c741d4cb6745fe6adb358a4176d971d28 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
 <html lang="en">\r
 <head>\r
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
 <meta http-equiv="Content-Style-Type" content="text/css">\r
 <link rel="up" title="FatFs" href="../00index_e.html">\r
 <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/lseek.html">\r
@@ -30,7 +30,7 @@ FRESULT f_expand (
 <dt>fp</dt>\r
 <dd>Pointer to the open file object.</dd>\r
 <dt>fsz</dt>\r
-<dd>Number of bytes in size to prepare or allocate for the file. The data type <tt>FSIZE_t</tt> is an alias of either <tt>DWORD</tt>(32-bit) or <tt>QWORD</tt>(64-bit) depends on the configuration option <tt>_FS_EXFAT</tt>.</dd>\r
+<dd>Number of bytes in size to prepare or allocate for the file. The data type <tt>FSIZE_t</tt> is an alias of either <tt>DWORD</tt>(32-bit) or <tt>QWORD</tt>(64-bit) depends on the configuration option <tt>FF_FS_EXFAT</tt>.</dd>\r
 <dt>opt</dt>\r
 <dd>Operation mode. Prepare only (0) or Allocate now (1).</dd>\r
 </dl>\r
@@ -57,16 +57,16 @@ FRESULT f_expand (
 <li>No free contiguous space was found.</li>\r
 <li>Size of the file was not zero.</li>\r
 <li>The file has been opened in read-only mode.</li>\r
-<li>Not allowable file size. (&gt;= 4GiB on FAT volume)</li>\r
+<li>Not allowable file size. (&gt;= 4 GB on FAT volume)</li>\r
 </ul>\r
 <p>When <tt class="arg">opt</tt> is 0, the function finds a contiguous data area and set it as suggested point for next allocation instead of allocating it to the file. The next cluster allocation is started at top of the contiguous area found by this function. Thus the write file is guaranteed be contiguous and no allocation delay until the size reaches that size at least unless any other changes to the volume is performed.</p>\r
-<p>The contiguous file would have an advantage at time-critical read/write operations. It reduces some overheads in the file system and the storage media caused by random access due to fragmented file data. Especially, at the exFAT volume, any FAT access for the contiguous file is completely eliminated and storage media will be accessed sequentially.</p>\r
-<p>Also the contiguous file data can be easily accessed directly via low-level disk functions but it is not recommended in consideration for future compatibility.</p>\r
+<p>The contiguous file would have an advantage at time-critical read/write operations. It eliminates some overheads in the filesystem and the storage media caused by random access due to fragmented file data. Especially FAT access for the contiguous file on the exFAT volume is completely eliminated and storage media will be accessed sequentially.</p>\r
+<p>Also the contiguous file can be easily accessed directly via low-level disk functions. But this is not recommended in consideration for future compatibility.</p>\r
 </div>\r
 \r
 <div class="para comp">\r
 <h4>QuickInfo</h4>\r
-<p>Available when <tt>_USE_EXPAND == 1</tt> and <tt>_FS_READONLY == 0</tt>.</p>\r
+<p>Available when <tt>FF_USE_EXPAND == 1</tt> and <tt>FF_FS_READONLY == 0</tt>.</p>\r
 </div>\r
 \r
 \r
@@ -79,28 +79,29 @@ FRESULT f_expand (
     res = f_open(fp = malloc(sizeof (FIL)), "file.dat", FA_WRITE|FA_CREATE_ALWAYS);\r
     if (res) { <span class="c">/* Check if the file has been opened */</span>\r
         free(fp);\r
-        ...\r
+        die("Failed to open the file.");\r
     }\r
 \r
     <span class="c">/* Alloacte a 100 MiB of contiguous area to the file */</span>\r
-    res = f_expand(fp, 104857600, 1);\r
+    res = <em>f_expand</em>(fp, 104857600, 1);\r
     if (res) { <span class="c">/* Check if the file has been expanded */</span>\r
-        ...\r
+        f_close(fp);\r
         free(fp);\r
-        ...\r
+        die("Failed to allocate contiguous area.");\r
     }\r
+\r
     <span class="c">/* Now you have a contiguous file accessible with fp */</span>\r
 \r
 </pre>\r
 <pre>\r
-    <span class="c">/* Accessing the file data directly via low-level disk functions */</span>\r
+    <span class="c">/* Accessing the contiguous file via low-level disk functions */</span>\r
 \r
     <span class="c">/* Get physical location of the file data */</span>\r
-    drv = fp-&gt;obj.fs-&gt;drv;\r
-    sect = fp-&gt;obj.fs-&gt;database + fp-&gt;obj.fs-&gt;csize * (fp-&gt;obj.sclust - 2);\r
+    drv = fp-&gt;obj.fs-&gt;pdrv;\r
+    lba = fp-&gt;obj.fs-&gt;database + fp-&gt;obj.fs-&gt;csize * (fp-&gt;obj.sclust - 2);\r
 \r
     <span class="c">/* Write 2048 sectors from top of the file at a time */</span>\r
-    res = disk_write(drv, buffer, sect, 2048);\r
+    res = disk_write(drv, buffer, lba, 2048);\r
 \r
 </pre>\r
 </div>\r