1 |
606 |
jeremybenn |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2 |
|
|
<html lang="en">
|
3 |
|
|
<head>
|
4 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5 |
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
6 |
|
|
<link rel="up" title="FatFs" href="../00index_e.html">
|
7 |
|
|
<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
|
8 |
|
|
<title>FatFs - Path Names</title>
|
9 |
|
|
</head>
|
10 |
|
|
|
11 |
|
|
<body>
|
12 |
|
|
|
13 |
|
|
<div class="para">
|
14 |
|
|
<h2>Format of the path names</h2>
|
15 |
|
|
<p>The path name format on the FatFs module is similer to the filename specs of DOS/Windos as follows:</p>
|
16 |
|
|
<pre>
|
17 |
|
|
"[<em>drive#</em>:][/]<em>directory</em>/<em>file</em>"
|
18 |
|
|
</pre>
|
19 |
|
|
<p>The FatFs module supports long file name (LFN) and 8.3 format file name (SFN). The LFN can be used when LFN feature is enabled <tt>(_USE_LFN > 0)</tt>. The differences between DOS/Windows are directory separator and logical drive number. The sub directories are separated with a / or \. The logical drive is specified in a numeral with a colon. When the drive number is omitted, it is assumed as default drive (0 or current drive). Leading/embedded spaces in the given path name are valid as a part of the name on LFN configuration but they are recognized as end of the path name on non-LFN configuration.</p>
|
20 |
|
|
<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 that follows from the root directory. Dot directory names are not allowed. Heading separator is ignored and it can be exist or omitted. The default drive number is fixed to 0.</p>
|
21 |
|
|
<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 allowed for the directory name. The default drive number is the current drive number set with <a href="chdrive.html">f_chdrive</a> function.</p>
|
22 |
|
|
<table class="lst2">
|
23 |
|
|
<tr><td>Path name</td><td>_FS_RPATH == 0</td><td>_FS_RPATH == 1</td></tr>
|
24 |
|
|
<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>
|
25 |
|
|
<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>
|
26 |
|
|
<tr><td></td><td>The root directory on the drive 0</td><td>The current directory on the current drive</td></tr>
|
27 |
|
|
<tr><td>2:</td><td>The root directory on the drive 2</td><td>The current directory on the drive 2</td></tr>
|
28 |
|
|
<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>
|
29 |
|
|
<tr><td>2:/</td><td>The root directory on the drive 2</td><td>The root directory on the drive 2</td></tr>
|
30 |
|
|
<tr><td>../file.txt</td><td>Invalid name</td><td>A file in the parent directory</td></tr>
|
31 |
|
|
<tr><td>.</td><td>Invalid name</td><td>This directory</td></tr>
|
32 |
|
|
<tr><td>..</td><td>Invalid name</td><td>Parent directory of the current directory</td></tr>
|
33 |
|
|
<tr><td>dir1/..</td><td>Invalid name</td><td>The current directory</td></tr>
|
34 |
|
|
<tr><td>/..</td><td>Invalid name</td><td>Invalid name (Cannot use dot names at the root directory)</td></tr>
|
35 |
|
|
</table>
|
36 |
|
|
</div>
|
37 |
|
|
|
38 |
|
|
<p><br></p>
|
39 |
|
|
<div class="para">
|
40 |
|
|
<h2>Unicode API</h2>
|
41 |
|
|
<p>The path names are input/output in either OEM code (SBCS/DBCS) or Unicode depends on the configuration options. The type of arguments that specifies the file names are defined as <tt>XCHAR</tt> which is an alias of <tt>char</tt> in default. The code set of the file name string is the OEM code set specifid by <tt>_CODE_PAGE</tt>. When <tt>_LFN_UNICODE</tt> is set to 1 under 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 ✝☪✡☸☭, can also be used for the path name.</p>
|
42 |
|
|
</div>
|
43 |
|
|
|
44 |
|
|
<p><br></p>
|
45 |
|
|
<div class="para">
|
46 |
|
|
<h2>Correspondence between logical and physical drives</h2>
|
47 |
|
|
<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>
|
48 |
|
|
<pre>
|
49 |
|
|
Example: Logical drive 0-2 are assigned to three pri-partitions on the physical drive 0 (fixed disk)
|
50 |
|
|
Logical drive 3 is assigned to physical drive 1 (removable disk)
|
51 |
|
|
|
52 |
|
|
const PARTITION Drives[] = {
|
53 |
|
|
{0, 0}, /* Logical drive 0 ==> Physical drive 0, 1st partition */
|
54 |
|
|
{0, 1}, /* Logical drive 1 ==> Physical drive 0, 2nd partition */
|
55 |
|
|
{0, 2}, /* Logical drive 2 ==> Physical drive 0, 3rd partition */
|
56 |
|
|
{1, 0} /* Logical drive 3 ==> Physical drive 1 */
|
57 |
|
|
};
|
58 |
|
|
</pre>
|
59 |
|
|
<p>There are some considerations when use <tt>_MULTI_PARTITION</tt> configuration.</p>
|
60 |
|
|
<ul>
|
61 |
|
|
<li>Only pri-partition (0-3) can be mounted.</li>
|
62 |
|
|
<li>When the physical drive has no partition table (SFD format), the partition number is ignored.</li>
|
63 |
|
|
<li>The physical drive that has two or more logical drives must be a fixed drive.</li>
|
64 |
|
|
</ul>
|
65 |
|
|
</div>
|
66 |
|
|
|
67 |
|
|
</body>
|
68 |
|
|
</html>
|