fatfs v0.07c Jun 21, 2009:

- Fixed f_unlink() may return FR_OK on error.
- Fixed wrong cache control in f_lseek().
- Added relative path feature.
- Added f_chdir().
- Added f_chdrive().
- Added proper case conversion to extended char.
This commit is contained in:
savelij13 committed 2025-09-11 09:33:51 +03:00
1 parent 3bb1c09ac4
commit 25f499b847
57 files changed
+1888 -982

No files matched your search

+31 -21
View File
@@ -1,40 +1,50 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<link rel="up" title="FatFs" href="../00index_e.html">
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
<title>FatFs - File and Path name on the FatFs module</title>
<title>FatFs - Path Names</title>
</head>
<body>
<div class="para">
<h2>File and Path name on the FatFs module</h2>
<p>The format of file and path name on the FatFs module is similer to MS-DOS. However it does not have a concept of current directory like OS oriented file system. All objects on the drive are always specified in full path name from the root directory.</p>
<h2>Format of the path names</h2>
<p>The path name format on the FatFs module is similer to MS-DOS as follows.</p>
<pre>
"[<em>drive#</em>:][/]<em>directory</em>/<em>file</em>"
"file1.txt" A file on the drive 0
"/file1.txt" (same as above)
"dir1/dir2/file1.txt" A file on the drive 0
"2:dir3/file2.txt" A file on the drive 2
"2:/dir5" A directory on the drive 2
"" The root directory on the drive 0
"/" (same as above)
"2:" The root directory on the drive 2
</pre>
<p>The FatFs module supports long file name and 8.3 format file name. The long file name can be handled when _USE_LFN option is selected. The sub directories are separated with a / or \. Heading separator is ignored and it may be exist or omitted.</p>
<p>The logical drive number is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0:).</p>
<p>The FatFs module supports long file name and 8.3 format file name. The long file name can be handled in LFN configuration <tt>(_USE_LFN == 1)</tt>. The path names are input/output in local code (SBCS/MBCS) or Unicode string depends on the configuration options. The sub directories are separated with a / or \. The logical drive number is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive).</p>
<p>In default configuration <tt>(_FS_RPATH == 0)</tt>, it does not have a concept of current directory like OS oriented file system. All objects on the volume are always specified in full path name following from the root directory. Dot names are not available. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.</p>
<p>When relative path feature is enabled <tt>(_FS_RPATH == 1)</tt>, specified path is followed from the root directory if a heading separator is exist. If not, the path is followed from the current directory set with <a href="chdir.html">f_chdir</a> function. Dot names are also available for the path name. The default drive number is the current drive number set with <a href="chdrive.html">f_chdrive</a> function.</p>
<table class="lst2">
<tr><td>Path name</td><td>_FS_RPATH == 0</td><td>_FS_RPATH == 1</td></tr>
<tr class="lst3"><td>file.txt</td><td>A file in the root directory on the drive 0</td><td>A file in the current directory on the current drive</td></tr>
<tr><td>/file.txt</td><td>A file in the root directory on the drive 0</td><td>A file in the root directory on the current drive</td></tr>
<tr><td></td><td>The root directory on the drive 0</td><td>The current directory on the current drive</td></tr>
<tr><td>2:</td><td>The root directory on the drive 2</td><td>The current directory on the drive 2</td></tr>
<tr><td>2:file.txt</td><td>A file in the root directory on the drive 2</td><td>A file in the current directory on the drive 2</td></tr>
<tr><td>2:/</td><td>The root directory on the drive 2</td><td>The root directory on the drive 2</td></tr>
<tr><td>../file.txt</td><td>Invalid name</td><td>A file in the parent directory</td></tr>
<tr><td>.</td><td>Invalid name</td><td>This directory</td></tr>
<tr><td>..</td><td>Invalid name</td><td>Parent directory of the current directory</td></tr>
<tr><td>dir1/..</td><td>Invalid name</td><td>The current directory</td></tr>
<tr><td>/..</td><td>Invalid name</td><td>Invalid name (Cannot use dot names at the root directory)</td></tr>
</table>
</div>
<p><br></p>
<div class="para">
<h2>Correspondence between logical/physical drive</h2>
<p>In default, the FatFs module has work areas that called <em>file system object</em> for each logical drive. The logical drive is bound to the physical drive that has same drive number, and the first partition is mounted. When <tt>_MULTI_PARTITION</tt> is specified in configuration option, each individual logical drive can be bound to any physical drive/partition. In this case, a drive number resolution table must be defined as follows:</p>
<h2>Unicode API</h2>
<p>The type of arguments that specifies the file names are defined as <tt>XCHAR</tt>, which is the alias of <tt>char</tt> in default. The code set of the file name string is the local code set that specifid by <tt>_CODE_PAGE</tt>. When <tt>_LFN_UNICODE</tt> is set to 1 with LFN configuration, the type of the <tt>XCHAR</tt> is switched to <tt>unsigned short</tt> (wide character) to support Unicode. In this case, the LFN feature is fully supported and the Unicode specific characters, such as ♥, ☭ and ❶, can also be used.</p>
</div>
<p><br></p>
<div class="para">
<h2>Correspondence between logical and physical drives</h2>
<p>The FatFs module has work areas that called <em>file system object</em> for each volume (logical drive). In default, the logical drive is bound to the physical drive that has same drive number, and the first partition is mounted. When <tt>_MULTI_PARTITION == 1</tt> is specified in configuration option, each individual logical drive can be bound to any physical drive/partition. In this case, a drive number resolution table must be defined as follows:</p>
<pre>
Example: Logical drive 0-2 are assigned to three pri-partitions on the physical drive 0 (fixed disk)
Logical drive 3 is assigned to physical drive 1 (removable disk)
@@ -49,8 +59,8 @@ const PARTITION Drives[] = {
<p>There are some consideration when use <tt>_MULTI_PARTITION</tt> configuration.</p>
<ul>
<li>Only pri-partition (0-3) can be mounted.</li>
<li>When the physical drive have no partition table (super floppy format), the partition number is ignored.</li>
<li>The physical drive that has two or more logical drives must be fixed drive.</li>
<li>When the physical drive has no partition table (SFD format), the partition number is ignored.</li>
<li>The physical drive that has two or more logical drives must not be removable drive.</li>
</ul>
</div>