Table of Contents |
---|
Nomenclature
...
It is typical to name a volume the same as a device; for example, a volume may be opened:Here, “vol:
” is the volume name. µC/FS imposes no restrictions on these names, except that they must end with a colon (‘:’), must be no more than FS_CFG_MAX_VOL_NAME_LEN
characters long, and must not contain either of the characters ‘\’ or ‘/’:
Code Block | ||
---|---|---|
| ||
FSVol_Open("sd:0:" (a)
"sd:0:" (b)
(void *)0,
&err);
|
In this case, the name of the volume (a) is the same as the name as the device (b). When multiple volumes exist in the same application, the volume name should be prefixed to the file or directory path name:
Code Block | ||
---|---|---|
| ||
p_file = fs_fopen("sd:0:\\dir01\file01.txt", "w"); // File on SD card p_file = fs_fopen("ram:0:\\dir01\file01.txt", "w"); // File on RAM disk |
µC/FS File and Directory Names and Paths
Files and directories are identified by a path string; for example, a file can be opened:In this case, “
Code Block | ||
---|---|---|
| ||
p_file = fs_fopen("\\test\\file001.txt |
...
", "w"); |
An application specifies the path of a file or directory using either an absolute or a relative path. An absolute path is a character string which specifies a unique file, and follows the pattern:In this case, “\\test\\file001.txt
” is the path string.
<vol_name>:<... Path ...><File>
...
<vol_name> | is the name of the volume, identical to the string specified in FSVol_Open(). |
<... Path ...> | is the file path, which must always begin and end with a ‘\’. |
<File> | is the file (or leaf directory) name, including any extension. |
For example:
Code Block |
---|
p_file = fs_fopen("sd:0:\\file.txt", "w"); (a) p_file = fs_fopen("\\file.txt", "w"); (b) p_file = fs_fopen("sd:0:\\dir01\\file01.txt", "w"); (c) p_file = fs_opendir("sd:0:\\") (d) p_file = fs_opendir("\\") (e) p_file = fs_opendir("sd:0:\\dir01\\") (f) |
Which demonstrate (a) opening a file in the root directory of a specified volume; (b) opening a file in the root directory on a default volume; (c) opening a file in a non-root directory; (d) opening the root directory of a specified volume; (e) opening the root directory of the default volume; (f) opening a non-root directory.
...
FullNameLenmax = VolNameLenmax + PathNameLenmax
demonstrates Figure - File, path and volume name lengths demonstrates these definitions.
Panel |
---|
No maximum parent name length is defined, though one may be derived. The parent name must be short enough so that the path of a file in the directory would be valid. Strictly, the minimum file name length is 1 character, though some OSs may enforce larger values (eleven on some Windows systems), thereby decreasing the maximum parent name length.
...