]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/doc/en/sfile.html
Import fatfs R0.12b
[z180-stamp.git] / fatfs / doc / en / sfile.html
index 1ed989907fe8ef8bbf97f497cb3316a5534185b9..5e53d167cc2f8058b74726498f2316d7cad28c81 100644 (file)
 \r
 <div class="para">\r
 <h2>FIL</h2>\r
-<p>The <tt>FIL</tt> structure (file object) holds the state of an open file. It is created by <tt>f_open()</tt> function and discarded by <tt>f_close()</tt> function. Application program must not modify any member in this structure except for <tt>cltbl</tt>. Note that a sector buffer is defined in this structure at non-tiny configuration (<tt>_FS_TINY == 0</tt>), so that the <tt>FIL</tt> structures at that configuration should not be defined as auto variable.</p>\r
+<p>The <tt>FIL</tt> structure (file object) holds the state of an open file. It is created by <tt>f_open</tt> function and discarded by <tt>f_close</tt> function. Application program must not modify any member in this structure except for <tt>cltbl</tt>, or any data on the FAT volume can be collapsed. Note that a sector buffer is defined in this structure at non-tiny configuration (<tt>_FS_TINY == 0</tt>), so that the <tt>FIL</tt> structures at that configuration should not be defined as auto variable.</p>\r
 \r
 <pre>\r
 <span class="k">typedef</span> <span class="k">struct</span> {\r
-    FATFS*  fs;           <span class="c">/* Pointer to the owner file system object */</span>\r
-    WORD    id;           <span class="c">/* Owner file system mount ID */</span>\r
+    _FDID   obj;          <span class="c">/* Owner file sytem object and object identifier */</span>\r
     BYTE    flag;         <span class="c">/* File object status flags */</span>\r
     BYTE    err;          <span class="c">/* Abort flag (error code) */</span>\r
-    DWORD   fptr;         <span class="c">/* File read/write pointer (Byte offset origin from top of the file) */</span>\r
-    DWORD   fsize;        <span class="c">/* File size in unit of byte */</span>\r
-    DWORD   sclust;       <span class="c">/* File start cluster */</span>\r
-    DWORD   clust;        <span class="c">/* Current cluster */</span>\r
-    DWORD   dsect;        <span class="c">/* Current data sector */</span>\r
+    FSIZE_t fptr;         <span class="c">/* File read/write pointer (Byte offset origin from top of the file) */</span>\r
+    DWORD   clust;        <span class="c">/* Current cluster of fptr (One cluster behind if fptr is on the cluster boundary. Invalid if fptr == 0.) */</span>\r
+    DWORD   sect;         <span class="c">/* Current data sector (Can be invalid if fptr is on the cluster boundary.)*/</span>\r
 <span class="k">#if</span> !_FS_READONLY\r
-    DWORD   dir_sect;     <span class="c">/* Sector containing the directory entry */</span>\r
+    DWORD   dir_sect;     <span class="c">/* Sector number containing the directory entry */</span>\r
     BYTE*   dir_ptr;      <span class="c">/* Ponter to the directory entry in the window */</span>\r
 <span class="k">#endif</span>\r
 <span class="k">#if</span> _USE_FASTSEEK\r
-    DWORD*  cltbl;        <span class="c">/* Pointer to the cluster link map table (Nulled on file open) */</span>\r
-<span class="k">#endif</span>\r
-<span class="k">#if</span> _FS_LOCK\r
-    UINT    lockid;       <span class="c">/* Fle lock ID */</span>\r
+    DWORD*  cltbl;        <span class="c">/* Pointer to the cluster link map table (Nulled on file open. Set by application.) */</span>\r
 <span class="k">#endif</span>\r
 <span class="k">#if</span> !_FS_TINY\r
-    BYTE    buf[_MAX_SS]; <span class="c">/* File private data transfer buffer */</span>\r
+    BYTE    buf[_MAX_SS]; <span class="c">/* File private data transfer buffer (Always valid if fptr is not on the sector boundary but can be invalid if fptr is on the sector boundary.) */</span>\r
 <span class="k">#endif</span>\r
 } FIL;\r
 </pre>\r