fatfs v0.15b June 21, 2025:
- Added support for timestamp of created time. (FF_FS_CRTIME) - Fixed FatFs fails to load the FsInfo in FAT32 volumes and the f_getfree always be forced a full FAT scan which takes a long time. (appeared at R0.15a)
This commit is contained in:
		
							parent
							
								
									47e601681a
								
							
						
					
					
						commit
						cc71f9a444
					
				| @ -17,7 +17,7 @@ | ||||
| 
 | ||||
| <div class="abst"> | ||||
| <img src="res/layers.png" class="rset" width="245" height="255" alt="layer"> | ||||
| <p>FatFs is a generic FAT/exFAT filesystem module for small embedded systems. The FatFs module is written in compliance with ANSI C (C89) and completely separated from the disk control layer. Therefore it is independent of the platforms and storage devices. It can be incorporated into small microcontrollers with limited resource, such as 8051, PIC, AVR, ARM, Z80, RX and etc. Also Petit FatFs module for tiny microcontrollers is available <a href="http://elm-chan.org/fsw/ff/00index_p.html">here</a>.</p> | ||||
| <p>FatFs is a generic FAT/exFAT filesystem module for small embedded systems. The FatFs module is written in compliance with ANSI C (C89) and completely separated from the disk control layer. Therefore it is independent of the platforms and storage devices. It can be incorporated into small microcontrollers with limited resource, such as 8051, PIC, AVR, ARM, Z80, RX and etc. Also Petit FatFs module for tiny microcontrollers is available <a href="https://elm-chan.org/fsw/ff/00index_p.html">here</a><span class="lnk">🔗</span>.</p> | ||||
| 
 | ||||
| <h4>Features</h4> | ||||
| <ul> | ||||
| @ -130,13 +130,15 @@ | ||||
| <p>The FatFs module is a free software opened for education, research and development. You can use, modify and/or redistribute it for any purpose without any restriction under your responsibility. For further information, refer to the application note.</p> | ||||
| <ul> | ||||
|  <li><em>Getting Started: <a href="doc/appnote.html">FatFs Application Note</a></em></li> | ||||
|  <li><a href="https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx">FAT32 Specification by Microsoft</a> (The authorized document on FAT filesystem)</li> | ||||
|  <li><a href="http://elm-chan.org/docs/fat_e.html">The basics of FAT filesystem</a> (FatFs is written based on this documentation)</li> | ||||
|  <li><a href="http://elm-chan.org/docs/exfat_e.html">The basics of exFAT filesystem</a> (FatFs is written based on this documentation)</li> | ||||
|  <li><a href="http://elm-chan.org/docs/mmc/mmc_e.html">How to use MMC/SDC</a></li> | ||||
|  <li><a href="http://elm-chan.org/junk/fa/faff.html">Playing with FlashAir and FatFs</a></li> | ||||
|  <li><a href="http://nemuisan.blog.bai.ne.jp/">Nemuisan's Blog</a> (Well written implementations for STM32F/SPI & SDIO and LPC4088/SDMMC)</li> | ||||
|  <li><a href="http://stm32f4-discovery.net/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/">Read SD card with FatFs on STM32F4xx devices by Tilen Majerle</a> (Quick and easy implementation for STM32F4-Discovery)</li> | ||||
|  <li>Download: <a href="https://elm-chan.org/fsw/ff/archives.html">Latest Release and Archives</a><span class="lnk">🔗</span></li> | ||||
|  <li>Community: <a href="https://elm-chan.org/fsw/ff/bd/">FatFs User Forum</a><span class="lnk">🔗</span></li> | ||||
|  <li><a href="https://msdn.microsoft.com/en-us/windows/hardware/gg463080.aspx">FAT32 Specification by Microsoft</a><span class="lnk">🔗</span> (The authorized document on FAT filesystem)</li> | ||||
|  <li><a href="https://elm-chan.org/docs/fat_e.html">The basics of FAT filesystem</a><span class="lnk">🔗</span> (FatFs is written based on this documentation)</li> | ||||
|  <li><a href="https://elm-chan.org/docs/exfat_e.html">The basics of exFAT filesystem</a><span class="lnk">🔗</span> (FatFs is written based on this documentation)</li> | ||||
|  <li><a href="https://elm-chan.org/docs/mmc/mmc_e.html">How to use MMC/SDC</a><span class="lnk">🔗</span></li> | ||||
|  <li><a href="https://elm-chan.org/junk/fa/faff.html">Playing with FlashAir and FatFs</a><span class="lnk">🔗</span></li> | ||||
|  <li><a href="https://nemuisan.blog.bai.ne.jp/">Nemuisan's Blog</a><span class="lnk">🔗</span> (Well written implementations for STM32F/SPI & SDIO and LPC4088/SDMMC)</li> | ||||
|  <li><a href="https://stm32f4-discovery.net/2014/07/library-21-read-sd-card-fatfs-stm32f4xx-devices/">Read SD card with FatFs on STM32F4xx devices by Tilen Majerle</a><span class="lnk">🔗</span> (Quick and easy implementation for STM32F4-Discovery)</li> | ||||
| </div> | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -106,17 +106,17 @@ The FatFs module is a middleware written in ANSI C (C89). There is no platform d | ||||
| <tr><th></th><th>ARM7<small><br>32bit</small></th><th>ARM7<small><br>Thumb</small></th><th>CM3<small><br>Thumb-2</small></th><th>AVR</th><th>H8/300H</th><th>PIC24</th><th>RL78</th><th>V850ES</th><th>SH-2A</th><th>RX600</th><th>IA-32</th></tr> | ||||
| <tr class="cal">     <td>Compiler</td><td>GCC</td><td>GCC</td><td>GCC</td><td>GCC</td><td>CH38</td><td>C30</td><td>CC78K0R</td><td>CA850</td><td>SHC</td><td>RXC</td><td>MSC</td></tr> | ||||
| <!--                                                      ARM        Thumb          CM3           AVR            H8          PIC24          RL78       V850ES        SH-2A        RX600        IA-32   --> | ||||
| <tr class="ral"><td class="cal">.text (Def, R/W)</td><td>10.4k</td><td>6.7k</td><td>6.1k</td><td>12.5k</td><td>11.0k</td><td>11.4k</td><td>13.0k</td><td>8.9k</td><td>9.2k</td><td>6.5k</td><td>8.9k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Min, R/W)</td> <td>7.0k</td><td>4.7k</td><td>4.2k</td> <td>8.5k</td> <td>7.6k</td> <td>7.9k</td> <td>9.5k</td><td>6.3k</td><td>6.4k</td><td>4.7k</td><td>6.4k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Def, R/O)</td> <td>4.9k</td><td>3.2k</td><td>2.7k</td> <td>6.1k</td> <td>5.2k</td> <td>5.4k</td> <td>6.5k</td><td>4.3k</td><td>4.2k</td><td>3.2k</td><td>4.3k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Min, R/O)</td> <td>3.7k</td><td>2.5k</td><td>2.1k</td> <td>4.4k</td> <td>4.0k</td> <td>4.2k</td> <td>5.1k</td><td>3.4k</td><td>3.3k</td><td>2.5k</td><td>3.5k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Def, R/W)</td><td>10.5k</td><td>6.7k</td><td>6.1k</td><td>12.6k</td><td>11.0k</td><td>11.4k</td><td>13.0k</td><td>8.9k</td><td>9.2k</td><td>6.5k</td><td>8.9k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Min, R/W)</td> <td>7.0k</td><td>4.7k</td><td>4.2k</td> <td>8.5k</td> <td>7.6k</td> <td>7.9k</td> <td>9.4k</td><td>6.3k</td><td>6.4k</td><td>4.7k</td><td>6.3k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Def, R/O)</td> <td>4.9k</td><td>3.2k</td><td>2.8k</td> <td>6.1k</td> <td>5.2k</td> <td>5.5k</td> <td>6.5k</td><td>4.4k</td><td>4.2k</td><td>3.2k</td><td>4.3k</td></tr> | ||||
| <tr class="ral"><td class="cal">.text (Min, R/O)</td> <td>3.7k</td><td>2.5k</td><td>2.1k</td> <td>4.4k</td> <td>4.0k</td> <td>4.2k</td> <td>5.0k</td><td>3.4k</td><td>3.3k</td><td>2.5k</td><td>3.4k</td></tr> | ||||
| <tr class="ral"><td class="cal">.bss</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*2 + 2</td><td>V*2 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td><td>V*4 + 2</td></tr> | ||||
| <tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 0)</small></td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*560<br>+ F*546</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td><td>V*564<br>+ F*552</td></tr> | ||||
| <tr class="ral"><td class="cal">Work area<br><small>(FF_FS_TINY == 1)</small></td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*560<br>+ F*34</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td><td>V*564<br>+ F*40</td></tr> | ||||
| </table> | ||||
| <p>These are the memory usage of FatFs module without lower layer on some target systems in following condition. <em>V</em> denotes number of mounted volumes and <em>F</em> denotes number of open files. Every samples here are optimezed in code size.</p> | ||||
| <pre> | ||||
| FatFs R0.15 options: | ||||
| FatFs R0.15b options: | ||||
| FF_FS_READONLY   0 (R/W, read/write) or 1 (R/O, read only) | ||||
| FF_FS_MINIMIZE   0 (Def, with all basic functions) or 3 (Min, with fully minimized) | ||||
| FF_FS_TINY       0 (Default) or 1 (Tiny file object) | ||||
| @ -202,7 +202,7 @@ And any other options are left unchanged from original setting. | ||||
| <div class="para doc" id="lba64"> | ||||
| <h3>64-bit LBA</h3> | ||||
| <p>LBA (Logical Block Addressing) is an addressing method to specify the location of data block, called <em>sector</em>, on the storage media. It is a simple linear address beginning from 0 as the first sector, 1 as the second sector and so on. The host system does not need to consider how the data block is located and managed in the storage device. FatFs supports only LBA for the media access. 32-bit LBA is a common size in the most LBA scheme. It can address up to 2<sup>32</sup> sectors, 2 TB in 512 bytes/sector. When a storage device larger than 2 TB is used, larger sector size or 64-bit LBA will be needed to address the entire sectors of the storage device.</p> | ||||
| <p>By default, FatFs works in 32-bit LBA for media access. FatFs can also switch it to 64-bit LBA by a configuration option <tt><a href="config.html#fs_lba64">FF_LBA64</a></tt>. It also enables GPT (GUID Partition Table) for partiotion management on the storage device. For further information about GPT, refer to <tt><a href="mkfs.html">f_mkfs</a></tt> and <tt><a href="fdisk.html">f_fdisk</a></tt> function.</p> | ||||
| <p>By default, FatFs works in 32-bit LBA for media access. FatFs can also switch it to 64-bit LBA by a configuration option <tt><a href="config.html#fs_lba64">FF_LBA64</a></tt>. It also enables GPT (GUID Partition Table) for partition management on the storage device. For further information about GPT, refer to <tt><a href="mkfs.html">f_mkfs</a></tt> and <tt><a href="fdisk.html">f_fdisk</a></tt> function.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para doc" id="reentrant"> | ||||
|  | ||||
| @ -25,7 +25,7 @@ FRESULT f_chmod ( | ||||
| <h4>Parameters</h4> | ||||
| <dl class="par"> | ||||
| <dt>path</dt> | ||||
| <dd>Pointer to the null-terminated string that specifies an <a href="filename.html">object</a> to be changed</dd> | ||||
| <dd>Pointer to the null-terminated string that specifies an <a href="filename.html">object</a> to be changed. If a null pointer is given, the function fails with <tt>FR_INVALID_OBJECT</tt>.</dd> | ||||
| <dt>attr</dt> | ||||
| <dd>Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.<br> | ||||
| <table class="lst"> | ||||
|  | ||||
| @ -56,6 +56,7 @@ | ||||
|    <li><a href="#fs_exfat">FF_FS_EXFAT</a></li> | ||||
|    <li><a href="#fs_nortc">FF_FS_NORTC</a></li> | ||||
|    <li><a href="#nortc_time">FF_NORTC_MON, FF_NORTC_MDAY, FF_NORTC_YEAR</a></li> | ||||
|    <li><a href="#fs_ctime">FF_FS_CTIME</a></li> | ||||
|    <li><a href="#fs_nofsinfo">FF_FS_NOFSINFO</a></li> | ||||
|    <li><a href="#fs_lock">FF_FS_LOCK</a></li> | ||||
|    <li><a href="#fs_reentrant">FF_FS_REENTRANT</a></li> | ||||
| @ -271,6 +272,9 @@ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb"}; | ||||
| <h4 id="nortc_time">FF_NORTC_MON, FF_NORTC_MDAY, FF_NORTC_YEAR</h4> | ||||
| <p>This set of options defines the time to be used in no RTC systems. This option has no effect in read-only configuration or <tt>FF_FS_NORTC == 0</tt>.</p> | ||||
| 
 | ||||
| <h4 id="fs_ctime">FF_FS_CTIME</h4> | ||||
| <p>This option enables (1) or disables (0) to access the file creation time with <tt>FILINFO</tt> structure.</p> | ||||
| 
 | ||||
| <h4 id="fs_nofsinfo">FF_FS_NOFSINFO</h4> | ||||
| <p>0 to 3. If you need to know correct free space on the FAT32 volume, set bit 0 of this option, and <tt>f_getfree</tt> function at first time after the volume mounted will force a full FAT scan. Bit 1 controls the use of last allocated cluster number for new allocation.</p> | ||||
| <table class="lst1"> | ||||
|  | ||||
| @ -58,7 +58,7 @@ DRESULT disk_write ( | ||||
| <h4>Description</h4> | ||||
| <p>The specified memory address is not that always aligned to word boundary because the argument is defined as <tt>BYTE*</tt>. For more information, refer to the description of <a href="dread.html"><tt>disk_read</tt></a> function.</p> | ||||
| <p>Generally, a multiple sector write request (<tt class="arg">count</tt><tt> > 1</tt>) must not be split into single sector transactions to the storage device, or the file write throughput will be drastically decreased.</p> | ||||
| <p>FatFs expects delayed write function in the disk control layer. The write operation to the media does not need to be completed when return from this function by what write operation is in progress or data is only stored into the write-back cache. The write data on the <tt class="arg">buff</tt> is invalid after return from this function. The write completion request is done by <tt>CTRL_SYNC</tt> command of <tt><a href="dioctl.html">disk_ioctl</a></tt> function. Therefore, if a delayed write function is implemented, the write throughput of the filesystem will be improved.</p> | ||||
| <p>FatFs expects the disk control layer may have a delayed write feature. The write operation to the media does not need to be completed when return from this function by what media write operation is in progress or data is stored into the write-back cache. The write data on the <tt class="arg">buff</tt> is invalid after return from this function. The write completion request is done by <tt>CTRL_SYNC</tt> command of <tt><a href="dioctl.html">disk_ioctl</a></tt> function. Therefore, if a delayed write feature is implemented, the write throughput of the filesystem will be improved.</p> | ||||
| <p><em>Remarks: Application program MUST NOT call this function, or FAT structure on the volume can be collapsed.</em></p> | ||||
| </div> | ||||
| 
 | ||||
|  | ||||
| @ -67,10 +67,10 @@ FRESULT f_findfirst ( | ||||
| <li><tt>*</tt> - An any string in length of zero or longer.</li> | ||||
| <li><tt>????*</tt> - An any string in length of four characters or longer.</li> | ||||
| </ul> | ||||
| <p>Since the matching algorithm uses recursion, number of wildcards in the matching pattern is limited to four to limit the stack usage. Any pattern with too many wildcards does not match any name. In LFN configuration, only <tt>fname[]</tt> is tested when <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested when <tt>FF_USE_FIND == 2</tt>. There are some differences listed below between FatFs and standard systems in matching condition.</p> | ||||
| <p>Since the matching algorithm uses recursion, number of wildcards in the matching pattern is limited to four to limit the stack usage. The pattern with too many wildcards does not match any name. In LFN configuration, only <tt>fname[]</tt> is tested when <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested when <tt>FF_USE_FIND == 2</tt>. There are some differences listed below between FatFs and standard systems in matching condition.</p> | ||||
| <ul> | ||||
| <li><tt>"*.*"</tt> does not match any name without extension while it matches any name with or without extension in standard systems.</li> | ||||
| <li>Any pattern terminated with a dot does not match any name while it matches the name without extensiton in standard systems.</li> | ||||
| <li>The pattern terminated with a dot does not match any name while it matches the name without extensiton in standard systems.</li> | ||||
| <li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive when LFN is enabled with <tt>!FF_LFN_UNICODE</tt>.</li> | ||||
| </ul> | ||||
| </div> | ||||
|  | ||||
| @ -61,8 +61,8 @@ FRESULT f_rewind ( | ||||
| <li>End of file. The specified <tt class="arg">ofs</tt> was clipped at end of the file in read-only mode.</li> | ||||
| <li>Disk full. There is no free space on the volume to expand the file.</li> | ||||
| </ul> | ||||
| <p>The fast seek feature enables fast backward/long seek operations without FAT access by using an on-memory CLMT (cluster link map table). It is applied to <tt>f_read</tt> and <tt>f_write</tt> function as well, however, the file size cannot be expanded by <tt>f_write</tt>, <tt>f_lseek</tt> function while the file is at fast seek mode.</p> | ||||
| <p>The fast seek mode is available when <tt>FF_USE_FASTSEEK = 1</tt>. The CLMT must be created into the <tt>DWORD</tt> array prior to use the fast seek mode. To create the CLMT, set address of the <tt>DWORD</tt> array to the member <tt>cltbl</tt> in the open file object, set the size of array in unit of items to the <tt>cltbl[0]</tt> and then call <tt>f_lseek</tt> function with <tt class="arg">ofs</tt><tt> = CREATE_LINKMAP</tt>. After the function succeeded, no FAT access is occured in subsequent <tt>f_read</tt>, <tt>f_write</tt>, <tt>f_lseek</tt> function to the file. The number of items used or required is returned into the <tt>cltbl[0]</tt>. The number of items needed is (number of the file fragments + 1) * 2. For example, 12 items in the array will be used for the file fragmented in 5 portions. If the function failed with <tt>FR_NOT_ENOUGH_CORE</tt>, the size of given array is insufficient for the file.</p> | ||||
| <p>The fast seek feature enables fast backward/long seek operations without FAT access by using an on-memory CLMT (cluster link map table). It is applied to <tt>f_read</tt> and <tt>f_write</tt> function as well, however, the file size cannot be expanded by <tt>f_write</tt>, <tt>f_lseek</tt> function while the file is in fast seek mode.</p> | ||||
| <p>The fast seek mode is available when <tt>FF_USE_FASTSEEK = 1</tt>. The CLMT must be created into a <tt>DWORD</tt> array prior to use the fast seek mode. To create the CLMT, set address of the <tt>DWORD</tt> array to the member <tt>cltbl</tt> in the open file object, set the size of array in unit of items to the <tt>cltbl[0]</tt> and then call <tt>f_lseek</tt> function with <tt class="arg">ofs</tt><tt> = CREATE_LINKMAP</tt>. The number of items used or required is returned into the <tt>cltbl[0]</tt>. The number of items needed is (number of the file fragments + 1) * 2. For example, 12 items in the array will be used for the file fragmented in 5 portions. If the function failed with <tt>FR_NOT_ENOUGH_CORE</tt>, the size of given array is insufficient for the file. After the function succeeded, no FAT access is occured in subsequent <tt>f_read</tt>, <tt>f_write</tt>, <tt>f_lseek</tt> function to the file. To disable the fast seek mode, set null pointer to the <tt>cltbl</tt>.</p> | ||||
| </div> | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -35,11 +35,11 @@ FRESULT f_mkfs ( | ||||
| <dt>BYTE n_fat</dt> | ||||
| <dd>Specifies number of FAT copies on the FAT/FAT32 volume. Valid value for this member is 1 or 2. The default value (0) and any invaid value gives 1. If the FAT type is exFAT, this member has no effect.</dd> | ||||
| <dt>UINT align</dt> | ||||
| <dd>Specifies alignment of the volume data area (file allocation pool, usually erase block boundary of flash memory media) <em>in unit of sector</em>. The valid value for this member is between 1 and 32768 inclusive in power of 2. If a zero (the default value) or any invalid value is given, the function obtains the block size from lower layer with <tt>disk_ioctl</tt> function.</dd> | ||||
| <dd>Specifies alignment of the volume data area (file allocation pool, usually erase block boundary of flash memory media) <em>in unit of sector</em>. The valid value for this member is between 1 and 32768 inclusive in power of 2. If a zero (the default value) or an invalid value is given, the function obtains the block size from lower layer with <tt>disk_ioctl</tt> function.</dd> | ||||
| <dt>UINT n_root</dt> | ||||
| <dd>Specifies number of root directory entries on the FAT volume. Valid value for this member is up to 32768 and aligned to sector size / 32. The default value (0) and any invaid value gives 512. If the FAT type is FAT32 or exFAT, this member has no effect.</dd> | ||||
| <dt>DWORD au_size</dt> | ||||
| <dd>Specifies size of the cluster (allocation unit) <em>in unit of byte</em>. The valid value for this member is between sector size and 128 * sector size inclusive in power of 2 for FAT/FAT32 volume and up to 16 MB in power of 2 for exFAT volume. If a zero (default value) or any invalid value is given, the function uses a default cluster size depends on the volume size.</dd> | ||||
| <dd>Specifies size of the cluster (allocation unit) <em>in unit of byte</em>. The valid value for this member is between sector size and 128 * sector size inclusive in power of 2 for FAT/FAT32 volume and up to 16 MB in power of 2 for exFAT volume. If a zero (default value) or an invalid value is given, the function uses a default cluster size depends on the volume size.</dd> | ||||
| </dl> | ||||
| <dt>work</dt> | ||||
| <dd>Pointer to the working buffer used for the format process. If a null pointer is given with <tt><a href="config.html#use_lfn">FF_USE_LFN</a> == 3</tt>, the function uses a <tt>len</tt> bytes of heap memory in this function.</dd> | ||||
| @ -68,8 +68,8 @@ FRESULT f_mkfs ( | ||||
| <p>The allocation unit, also known as <em>cluster</em>, is a unit of disk space allocation for files. When the size of allocation unit is 32768 bytes, a file with 100 bytes in size occupies 32768 bytes of disk space. The space efficiency of disk usage gets worse as increasing size of allocation unit, but, on the other hand, the read/write performance increases. Therefore the size of allocation unit is a trade-off between space efficiency and performance. For the large volumes in GB order, 32768 bytes or larger, automatically selected by default, is recommended for most case unless extremely many small files are created in the volume.</p> | ||||
| <p>When the logical drive to be formatted is associated with a physical drive (<tt><a href="config.html#multi_partition">FF_MULTI_PARTITION</a> == 0</tt> or <tt>VolToPart[].pt == 0</tt>) and <tt>FM_SFD</tt> flag is not specified, a partition occupies entire drive space is created and then the FAT volume is created in the partition. When <tt>FM_SFD</tt> flag is specified, the FAT volume is created without any disk partitioning.</p> | ||||
| <p>When the logical drive to be formatted is associated with a specific partition by multiple partition feature (<tt>FF_MULTI_PARTITION == 1</tt> and <tt>VolToPart[].pt > 0</tt>), the FAT volume is created in the partition of the physical drive specified by <a href="filename.html#vol">volume mapping table</a> and <tt>FM_SFD</tt> flag is ignored. The hosting physical drive needs to be partitioned with <tt>f_fdisk</tt> function or some partitioning tool prior to create the FAT volume with this function. If the partition is not exist, the function fails with <tt>FR_MKFS_ABORTED</tt>.</p> | ||||
| <p>There are three standard disk partitioning formats, MBR, GPT and SFD. The MBR format, also known as FDISK format, is usually used for harddisk, memory card and U disk. It can divide a physical drive into one or more partitions with a partition table. The GPT, GUID Partition Table, is a newly defined patitioning format for large storage devices. FatFs suppors the GPT only when 64-bit LBA is enabled. The SFD, Super-Floppy Disk, is non-partitioned disk format. The FAT volume is located at LBA 0 and occupies the entire physical drive without any disk partitioning. It is usually used for floppy disk, optical disk and most super-floppy media. Some combination of systems and media support only either partitioned format or non-partitioned format and the other is not supported.</p> | ||||
| <p>Some systems manage the partitions in the on-board storage in non-standard format. The partitions are mapped as physical drives identified by <tt class="arg">pdrv</tt> in <tt>disk_*</tt> functions. For such systems, SFD format is suitable to create the FAT volume in the partition.</p> | ||||
| <p>There are three standard disk partitioning formats, MBR, GPT and SFD. The MBR format, also known as FDISK format, is usually used for harddisk, memory card and U disk. It can divide a physical drive into one or more partitions with a partition table. The GPT, GUID Partition Table, is a newly defined patitioning format for large storage devices. FatFs suppors the GPT only when 64-bit LBA is enabled. The SFD, Super-Floppy Disk, is non-partitioned disk format. The FAT volume is located at LBA 0 and occupies the entire physical drive without disk partitioning. It is usually used for floppy disk, optical disk and most super-floppy media. Some combination of systems and media support only either partitioned format or non-partitioned format and the other is not supported.</p> | ||||
| <p>Some systems manage the partitions of on-board storage in non-standard format. The partitions are mapped as physical drives identified by <tt class="arg">pdrv</tt> in <tt>disk_*</tt> functions. For such systems, SFD format is suitable to create the FAT volume in the partition.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para comp"> | ||||
|  | ||||
| @ -86,16 +86,16 @@ FRESULT list_dir (const char *path) | ||||
|     int nfile, ndir; | ||||
| 
 | ||||
| 
 | ||||
|     res = <em>f_opendir</em>(&dir, path);                       <span class="c">/* Open the directory */</span> | ||||
|     res = <em>f_opendir</em>(&dir, path);                   <span class="c">/* Open the directory */</span> | ||||
|     if (res == FR_OK) { | ||||
|         nfile = ndir = 0; | ||||
|         for (;;) { | ||||
|             res = <em>f_readdir</em>(&dir, &fno);                   <span class="c">/* Read a directory item */</span> | ||||
|             if (res != FR_OK || fno.fname[0] == 0) break;  <span class="c">/* Error or end of dir */</span> | ||||
|             if (fno.fattrib & AM_DIR) {            <span class="c">/* Directory */</span> | ||||
|             res = <em>f_readdir</em>(&dir, &fno);           <span class="c">/* Read a directory item */</span> | ||||
|             if (fno.fname[0] == 0) break;          <span class="c">/* Error or end of dir */</span> | ||||
|             if (fno.fattrib & AM_DIR) {            <span class="c">/* It is a directory */</span> | ||||
|                 printf("   <DIR>   %s\n", fno.fname); | ||||
|                 ndir++; | ||||
|             } else {                               <span class="c">/* File */</span> | ||||
|             } else {                               <span class="c">/* It is a file */</span> | ||||
|                 printf("%10u %s\n", fno.fsize, fno.fname); | ||||
|                 nfile++; | ||||
|             } | ||||
| @ -121,18 +121,18 @@ FRESULT scan_files ( | ||||
|     static FILINFO fno; | ||||
| 
 | ||||
| 
 | ||||
|     res = <em>f_opendir</em>(&dir, path);                       <span class="c">/* Open the directory */</span> | ||||
|     res = <em>f_opendir</em>(&dir, path);                   <span class="c">/* Open the directory */</span> | ||||
|     if (res == FR_OK) { | ||||
|         for (;;) { | ||||
|             res = <em>f_readdir</em>(&dir, &fno);                   <span class="c">/* Read a directory item */</span> | ||||
|             if (res != FR_OK || fno.fname[0] == 0) break;  <span class="c">/* Break on error or end of dir */</span> | ||||
|             if (fno.fattrib & AM_DIR) {                    <span class="c">/* It is a directory */</span> | ||||
|             res = <em>f_readdir</em>(&dir, &fno);           <span class="c">/* Read a directory item */</span> | ||||
|             if (fno.fname[0] == 0) break;          <span class="c">/* Break on error or end of dir */</span> | ||||
|             if (fno.fattrib & AM_DIR) {            <span class="c">/* The item is a directory */</span> | ||||
|                 i = strlen(path); | ||||
|                 sprintf(&path[i], "/%s", fno.fname); | ||||
|                 res = scan_files(path);                    <span class="c">/* Enter the directory */</span> | ||||
|                 res = scan_files(path);            <span class="c">/* Enter the directory */</span> | ||||
|                 if (res != FR_OK) break; | ||||
|                 path[i] = 0; | ||||
|             } else {                                       <span class="c">/* It is a file. */</span> | ||||
|             } else {                               <span class="c">/* The item is a file. */</span> | ||||
|                 printf("%s/%s\n", path, fno.fname); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -55,7 +55,7 @@ FRESULT f_setlabel ( | ||||
| <li>Allowable characters for exFAT volume are: characters allowed for LFN includes dot. Low-case characters are preserved.</li> | ||||
| <li>Spaces can be embedded anywhere in the volume label. Trailing spaces are truncated off at FAT volume.</li> | ||||
| </ul> | ||||
| <p>Remark: The standard system (Windows) has a problem at the volume label with a heading <tt>\xE5</tt> on the FAT volume. To avoid this problem, this function rejects such volume label as invalid name.</p> | ||||
| <p>Remark: The standard system (Windows) has a problem in the volume label with a heading <tt>\xE5</tt> on the FAT volume. To avoid this problem, this function rejects such volume label as invalid name.</p> | ||||
| </div> | ||||
| 
 | ||||
| <div class="para comp"> | ||||
|  | ||||
| @ -17,6 +17,10 @@ | ||||
|     FSIZE_t fsize;               <span class="c">/* File size */</span> | ||||
|     WORD    fdate;               <span class="c">/* Last modified date */</span> | ||||
|     WORD    ftime;               <span class="c">/* Last modified time */</span> | ||||
| <span class="k">#if</span> FF_FS_CRTIME | ||||
|     WORD    crdate;              <span class="c">/* Created date */</span> | ||||
|     WORD    crtime;              <span class="c">/* Created time */</span> | ||||
| <span class="k">#endif</span> | ||||
|     BYTE    fattrib;             <span class="c">/* Attribute */</span> | ||||
| <span class="k">#if</span> FF_USE_LFN | ||||
|     TCHAR   altname[FF_SFN_BUF + 1]; <span class="c">/* Alternative object name */</span> | ||||
| @ -54,6 +58,12 @@ | ||||
| <dd>Second / 2 (0..29)</dd> | ||||
| </dl> | ||||
| </dd> | ||||
| <dt>crdate</dt> | ||||
| <dd>The date when the file/directory was created. This member is available when <tt><a href="config.html#fs_ctime">FF_FS_CRTIME</a> = 1</tt>. | ||||
| </dd> | ||||
| <dt>crtime</dt> | ||||
| <dd>The time when the file/directory was created. This member is available when <tt>FF_FS_CRTIME = 1</tt> | ||||
| </dd> | ||||
| <dt>fattrib</dt> | ||||
| <dd>The attribute flags in combination of:<br> | ||||
| <table class="lst"> | ||||
| @ -66,7 +76,7 @@ | ||||
| </table> | ||||
| </dd> | ||||
| <dt>fname[]</dt> | ||||
| <dd>Null-terminated object name. A null string is stored when no item to read and it indicates this structure is invalid. The size of <tt>fname[]</tt> and <tt>altname[]</tt> each can be configured in LFN configuration.</dd> | ||||
| <dd>Null-terminated object name is stored. If no item to read or an error occured in the function, a null string is stored to indicate this structure is invalid. The size of <tt>fname[]</tt> and <tt>altname[]</tt> each can be configured in LFN configuration.</dd> | ||||
| <dt>altname[]</dt> | ||||
| <dd>Alternative object name is stored if available. This member is not available in non-LFN configuration.</dd> | ||||
| </dl> | ||||
|  | ||||
| @ -102,7 +102,7 @@ FRESULT f_stat ( | ||||
| 
 | ||||
| 
 | ||||
| <div class="para ref"> | ||||
| <h4>References</h4> | ||||
| <h4>See Also</h4> | ||||
| <p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a></tt></p> | ||||
| </div> | ||||
| 
 | ||||
|  | ||||
| @ -15,7 +15,7 @@ | ||||
| <pre> | ||||
| FRESULT f_utime ( | ||||
|   const TCHAR* <span class="arg">path</span>,  <span class="c">/* [IN] Object name */</span> | ||||
|   const FILINFO* <span class="arg">fno</span>  <span class="c">/* [IN] Time and data to be set */</span> | ||||
|   const FILINFO* <span class="arg">fno</span>  <span class="c">/* [IN] Time and date to be set */</span> | ||||
| ); | ||||
| </pre> | ||||
| </div> | ||||
| @ -26,7 +26,7 @@ FRESULT f_utime ( | ||||
| <dt>path</dt> | ||||
| <dd>Pointer to the null-terminated string that specifies an <a href="filename.html">object</a> to be changed. If a null pointer is given, the function fails with <tt>FR_INVALID_DRIVE</tt>.</dd> | ||||
| <dt>fno</dt> | ||||
| <dd>Pointer to the file information structure that has a timestamp to be set in member fdate and ftime. Do not care any other members.</dd> | ||||
| <dd>Pointer to the file information structure that has new timestamps to be set in the members. <tt>fdate</tt> and <tt>ftime</tt> are for the last modified time. When <tt><a href="config.html#fs_ctime">FF_FS_CRTIME</a> = 1</tt>, <tt>crdate</tt> and <tt>crtime</tt> for the created time are available in addition. Every timestamp is in local time. If <tt>fdate</tt> or <tt>crdate</tt> is invalid (0), the modified time or created time is left unchanged respectively. Do not care any other member.</dd> | ||||
| </dl> | ||||
| </div> | ||||
| 
 | ||||
| @ -61,7 +61,7 @@ FRESULT f_utime ( | ||||
| <h4>Example</h4> | ||||
| <pre> | ||||
| FRESULT set_timestamp ( | ||||
|     char *obj,     <span class="c">/* Pointer to the file name */</span> | ||||
|     const char *fname,     <span class="c">/* Pointer to the file name */</span> | ||||
|     int year, | ||||
|     int month, | ||||
|     int mday, | ||||
| @ -74,8 +74,10 @@ FRESULT set_timestamp ( | ||||
| 
 | ||||
|     fno.fdate = (WORD)(((year - 1980) * 512U) | month * 32U | mday); | ||||
|     fno.ftime = (WORD)(hour * 2048U | min * 32U | sec / 2U); | ||||
| 
 | ||||
|     return <em>f_utime</em>(obj, &fno); | ||||
| <span class="k">#if</span> FF_FS_CRTIME | ||||
|     fno.crdate = 0;   <span class="c">/* Do not change created time in this code */</span> | ||||
| <span class="k">#endif</span> | ||||
|     return <em>f_utime</em>(fname, &fno); | ||||
| } | ||||
| </pre> | ||||
| </div> | ||||
|  | ||||
| @ -4,14 +4,38 @@ | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||||
| <meta http-equiv="Content-Style-Type" content="text/css"> | ||||
| <meta http-equiv="cache-control" content="no-cache"> | ||||
| <link rel="start" title="Site Top" href="../../"> | ||||
| <link rel="stylesheet" href="css_e.css" type="text/css" media="screen" title="ELM Default"> | ||||
| <title>FatFs - Updates and Migration Notes</title> | ||||
| </head> | ||||
| <body style="max-width: none;"> | ||||
| <h2>Updates and Migration Notes</h2> | ||||
| <table class="lst4"> | ||||
| 
 | ||||
| <tr><th>Revision</th><th>Updates</th><th>Migration Notes</th></tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.15b<br>Jun 21, 2025</td> | ||||
| <td> | ||||
| Added support for timestamp of created time. (<tt>FF_FS_CRTIME</tt>)<br> | ||||
| Fixed FatFs fails to load the FsInfo in FAT32 volumes and the <tt>f_getfree</tt> always be forced a full FAT scan which takes a long time. (appeared at R0.15a)<br> | ||||
| </td> | ||||
| <td> | ||||
| Small changes to the <tt>f_utime</tt> function to support for the timestamp of created time.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.15a<br>Nov 22, 2024</td> | ||||
| <td> | ||||
| Fixed a complie error when <tt>FF_FS_LOCK != 0</tt>. (appeared at R0.15)</br> | ||||
| Fixed a potential issue when work FatFs concurrency with <tt>FF_FS_REENTRANT</tt>, <tt>FF_VOLUMES >= 2</tt> and <tt>FF_FS_LOCK > 0</tt>.<br> | ||||
| Made <tt>f_setlabel</tt> accept a volume label with Unix style volume ID when <tt>FF_STR_VOLUME_ID == 2</tt>.<br> | ||||
| Made FatFs update <tt>PercInUse</tt> field in exFAT VBR. (A preceding <tt>f_getfree</tt> is needed for the accuracy)<br> | ||||
| </td> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.15<br>Nov 6, 2022</td> | ||||
| <td> | ||||
| @ -27,6 +51,7 @@ User provided synchronization functions, <tt>ff_cre_syncobj</tt>, <tt>ff_del_syn | ||||
| <tt>FF_SYNC_t</tt> is removed from the configuration options.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.14b<br>Apr 17, 2021</td> | ||||
| <td> | ||||
| @ -43,6 +68,7 @@ Fixed some compiler warnings.<br> | ||||
| From this revision, FatFs depends on <tt>string.h</tt>.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.14a<br>Dec 05, 2020</td> | ||||
| <td> | ||||
| @ -54,6 +80,7 @@ Fixed some compiler warnings.<br> | ||||
| Number of wildcards in the matching pattern in <tt>f_findfirst</tt> is limited to 4.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.14<br>Oct 14, 2019</td> | ||||
| <td> | ||||
| @ -68,6 +95,7 @@ Fixed <tt>f_mkfs</tt> can fail to create exFAT volume in the second partition. ( | ||||
| Usage of <tt>f_mkfs</tt> and <tt>f_fdisk</tt> is changed and some features are added to these functions.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.13c<br>Oct 14, 2018</td> | ||||
| <td> | ||||
| @ -81,6 +109,7 @@ From this revision, FatFs depends on <tt>stdint.h</tt> in C99 or later.<br> | ||||
| <tt>integer.h</tt> is removed.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.13b<br>Apr 07, 2018</td> | ||||
| <td> | ||||
| @ -92,6 +121,7 @@ Fixed <tt>f_setlabel</tt> does not reject some invalid characters. (appeared at | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.13a<br>Oct 14, 2017</td> | ||||
| <td> | ||||
| @ -105,6 +135,7 @@ Fixed <tt>f_setlabel</tt> rejects some valid characters for exFAT volume. (appea | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.13<br>May 21, 2017</td> | ||||
| <td> | ||||
| @ -121,6 +152,7 @@ Fixed creating a file can fail when a new cluster allocation to the exFAT direct | ||||
| ASCII only configuration, <tt>FF_CODE_PAGE = 1</tt>, is removed. Use <tt>FF_CODE_PAGE = 437</tt> instead.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.12c<br>Mar 04, 2017</td> | ||||
| <td> | ||||
| @ -132,6 +164,7 @@ Fixed configuration option <tt>_VOLUMES</tt> cannot be set 10. (appeared at R0.1 | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.12b<br>Sep 4, 2016</td> | ||||
| <td> | ||||
| @ -147,6 +180,7 @@ Fixed some internal errors in <tt>f_expand</tt> and <tt>f_lseek.</tt> (appeared | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.12a<br>Jul 10, 2016</td> | ||||
| <td> | ||||
| @ -161,6 +195,7 @@ Fixed compilation fails at some configurations, <tt>_USE_FASTSEEK</tt> and <tt>_ | ||||
| Usage of <tt>f_mkfs</tt> is changed.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.12<br>Apr 12, 2016</td> | ||||
| <td> | ||||
| @ -180,6 +215,7 @@ To use <tt>f_chmod</tt>, <tt>_USE_CHMOD</tt> needs to be set.<br> | ||||
| <tt>_WORD_ACCESS</tt> is removed from the configuration options.<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.11a<br>Sep 5, 2015</td> | ||||
| <td> | ||||
| @ -192,6 +228,7 @@ Fixed errors in the case conversion teble of Unicode (<tt>cc*.c</tt>).<br> | ||||
| Removed some code pages actually not exist on the standard systems. (<tt>_CODE_PAGE</tt>)<br> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.11<br>Feb 9, 2015</td> | ||||
| <td> | ||||
| @ -202,6 +239,7 @@ Fixed <tt>_FS_NORTC</tt> option does not work properly. (appeared at R0.10c)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.10c<br>Nov 9, 2014</td> | ||||
| <td> | ||||
| @ -213,6 +251,7 @@ Fixed null pointer dereference on attempting to delete the root direcotry. (appe | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.10b<br>May 19, 2014</td> | ||||
| <td> | ||||
| @ -222,6 +261,7 @@ Fixed LFN entry is not deleted on delete/rename an object with its lossy convert | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.10a<br>Jan 15, 2014</td> | ||||
| <td> | ||||
| @ -236,6 +276,7 @@ Fixed creation of a directory entry with LFN fails on too many SFN collisions. ( | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.10<br>Oct 2, 2013</td> | ||||
| <td> | ||||
| @ -252,6 +293,7 @@ Fixed <tt>f_open</tt>, <tt>f_mkdir</tt> and <tt>f_setlabel</tt> can return incor | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.09b<br>Jan 24, 2013</td> | ||||
| <td> | ||||
| @ -260,6 +302,7 @@ Added <tt>f_getlabel</tt> and <tt>f_setlabel</tt>. (<tt>_USE_LABEL</tt>)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.09a<br>Aug 27, 2012</td> | ||||
| <td> | ||||
| @ -270,6 +313,7 @@ Changed option name <tt>_FS_SHARE</tt> to <tt>_FS_LOCK</tt>.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.09<br>Sep 6, 2011</td> | ||||
| <td> | ||||
| @ -279,6 +323,7 @@ Added <tt>f_fdisk</tt>. (<tt>_MULTI_PARTITION = 2</tt>)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.08b<br>Jan 15, 2011</td> | ||||
| <td> | ||||
| @ -290,6 +335,7 @@ Ignores duplicated directory separators in given path names.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.08a<br>Aug 16, 2010</td> | ||||
| <td> | ||||
| @ -302,6 +348,7 @@ Fixed <tt>f_mkfs</tt> creates wrong FAT32 volume.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.08<br>May 15, 2010</td> | ||||
| <td> | ||||
| @ -315,6 +362,7 @@ String functions support UTF-8 encoding files on Unicode cfg.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.07e<br>Nov 3, 2009</td> | ||||
| <td> | ||||
| @ -327,6 +375,7 @@ Changed <tt>f_readdir</tt> to return the SFN with always upper case on non-LFN c | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.07c<br>Jan 21, 2009</td> | ||||
| <td> | ||||
| @ -340,6 +389,7 @@ Added proper case conversion to extended characters.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.07a<br>Apr 14, 2009</td> | ||||
| <td> | ||||
| @ -349,6 +399,7 @@ Added multiple sector size support.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.07<br>Apr 1, 2009</td> | ||||
| <td> | ||||
| @ -364,6 +415,7 @@ Renamed string functions to avoid name collision.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.06<br>Apr 1, 2008</td> | ||||
| <td> | ||||
| @ -374,6 +426,7 @@ Improved performance of <tt>f_lseek</tt> on moving to the same or following clus | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.05a<br>Feb 3, 2008</td> | ||||
| <td> | ||||
| @ -386,6 +439,7 @@ Fixed cached sector is left not flushed when create and close without write.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.05<br>Aug 26, 2007</td> | ||||
| <td> | ||||
| @ -397,6 +451,7 @@ Fixed <tt>f_mkdir</tt> on FAT32 creates broken directory. (FatFs)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.04b<br>May 5, 2007</td> | ||||
| <td> | ||||
| @ -409,6 +464,7 @@ Fixed short seek (<tt><= csize</tt>) collapses the file object.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.04a<br>Apr 1, 2007</td> | ||||
| <td> | ||||
| @ -421,6 +477,7 @@ Fixed a problem corresponds to FAT32 support. (Tiny-FatFs)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.04<br>Feb 4, 2007</td> | ||||
| <td> | ||||
| @ -432,6 +489,7 @@ Added <tt>_USE_FAT32</tt> option. (Tiny-FatFs)<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.03a<br>Dec 11, 2006</td> | ||||
| <td> | ||||
| @ -441,6 +499,7 @@ Fixed <tt>f_mkdir</tt> creates broken directory on FAT32.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.03<br>Sep 22, 2006</td> | ||||
| <td> | ||||
| @ -450,6 +509,7 @@ Changed option <tt>_FS_MINIMUM</tt> to <tt>_FS_MINIMIZE</tt>.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.02a<br>Jun 10, 2006</td> | ||||
| <td> | ||||
| @ -458,6 +518,7 @@ Added a configuration option <tt>_FS_MINIMUM</tt>.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.02<br>Jun 01, 2006</td> | ||||
| <td> | ||||
| @ -468,6 +529,7 @@ Fixed a problem on small (<tt><32M</tt>) patition.<br> | ||||
| <td> | ||||
| </td> | ||||
| </tr> | ||||
| 
 | ||||
| <tr> | ||||
| <td>R0.01<br>Apr 29, 2006</td> | ||||
| <td> | ||||
| @ -477,5 +539,6 @@ First release.<br> | ||||
| </td> | ||||
| </tr> | ||||
| </table> | ||||
| <p class="foot"><a href=".">Return</a></p> | ||||
| </body> | ||||
| </html> | ||||
|  | ||||
| @ -375,3 +375,9 @@ R0.15a (November 22, 2024) | ||||
|   Made f_setlabel() accept a volume label in Unix style volume ID when FF_STR_VOLUME_ID == 2. | ||||
|   Made FatFs update PercInUse field in exFAT VBR. (A preceding f_getfree() is needed for the accuracy) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| R0.15b (June 21, 2025) | ||||
|   Added support for timestamp of created time. (FF_FS_CRTIME) | ||||
|   Fixed FatFs fails to load the FsInfo in FAT32 volumes and the f_getfree always be forced a full FAT scan which takes a long time. (appeared at R0.15a) | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										551
									
								
								source/ff.c
									
									
									
									
									
								
							
							
						
						
									
										551
									
								
								source/ff.c
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										36
									
								
								source/ff.h
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								source/ff.h
									
									
									
									
									
								
							| @ -1,8 +1,8 @@ | ||||
| /*----------------------------------------------------------------------------/
 | ||||
| /  FatFs - Generic FAT Filesystem module  R0.15a                              / | ||||
| /  FatFs - Generic FAT Filesystem module  R0.15b                              / | ||||
| /-----------------------------------------------------------------------------/ | ||||
| / | ||||
| / Copyright (C) 2024, ChaN, all right reserved. | ||||
| / Copyright (C) 2025, ChaN, all right reserved. | ||||
| / | ||||
| / FatFs module is an open source software. Redistribution and use of FatFs in | ||||
| / source and binary forms, with or without modification, are permitted provided | ||||
| @ -20,7 +20,7 @@ | ||||
| 
 | ||||
| 
 | ||||
| #ifndef FF_DEFINED | ||||
| #define FF_DEFINED	5380	/* Revision ID */ | ||||
| #define FF_DEFINED	5385	/* Revision ID */ | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| extern "C" { | ||||
| @ -131,11 +131,11 @@ extern const char* VolumeStr[FF_VOLUMES];	/* User defined volume ID table */ | ||||
| /* Filesystem object structure (FATFS) */ | ||||
| 
 | ||||
| typedef struct { | ||||
| 	BYTE	fs_type;		/* Filesystem type (0:blank filesystem object) */ | ||||
| 	BYTE	fs_type;		/* Filesystem type (0:not mounted) */ | ||||
| 	BYTE	pdrv;			/* Volume hosting physical drive */ | ||||
| 	BYTE	ldrv;			/* Logical drive number (used only when FF_FS_REENTRANT) */ | ||||
| 	BYTE	n_fats;			/* Number of FATs (1 or 2) */ | ||||
| 	BYTE	wflag;			/* win[] status (1:dirty) */ | ||||
| 	BYTE	wflag;			/* win[] status (b0:dirty) */ | ||||
| 	BYTE	fsi_flag;		/* Allocation information control (b7:disabled, b0:dirty) */ | ||||
| 	WORD	id;				/* Volume mount ID */ | ||||
| 	WORD	n_rootdir;		/* Number of root directory entries (FAT12/16) */ | ||||
| @ -144,33 +144,29 @@ typedef struct { | ||||
| 	WORD	ssize;			/* Sector size (512, 1024, 2048 or 4096) */ | ||||
| #endif | ||||
| #if FF_USE_LFN | ||||
| 	WCHAR*	lfnbuf;			/* LFN working buffer */ | ||||
| #endif | ||||
| #if FF_FS_EXFAT | ||||
| 	BYTE*	dirbuf;			/* Directory entry block scratch pad buffer for exFAT */ | ||||
| 	WCHAR	*lfnbuf;		/* LFN working buffer */ | ||||
| #endif | ||||
| #if !FF_FS_READONLY | ||||
| 	DWORD	last_clst;		/* Last allocated cluster (Unknown if >= n_fatent) */ | ||||
| 	DWORD	free_clst;		/* Number of free clusters (Unknown if >= n_fatent-2) */ | ||||
| 	DWORD	last_clst;		/* Last allocated cluster (Unknown if >=n_fatent) */ | ||||
| 	DWORD	free_clst;		/* Number of free clusters (Unknown if >=fs->n_fatent-2) */ | ||||
| #endif | ||||
| #if FF_FS_RPATH | ||||
| 	DWORD	cdir;			/* Current directory start cluster (0:root) */ | ||||
| #if FF_FS_EXFAT | ||||
| 	DWORD	cdc_scl;		/* Containing directory start cluster (invalid when cdir is 0) */ | ||||
| 	DWORD	cdc_size;		/* b31-b8:Size of containing directory, b7-b0: Chain status */ | ||||
| 	DWORD	cdc_ofs;		/* Offset in the containing directory (invalid when cdir is 0) */ | ||||
| #endif | ||||
| #endif | ||||
| 	DWORD	n_fatent;		/* Number of FAT entries (number of clusters + 2) */ | ||||
| 	DWORD	fsize;			/* Number of sectors per FAT */ | ||||
| 	LBA_t	winsect;		/* Current sector appearing in the win[] */ | ||||
| 	LBA_t	volbase;		/* Volume base sector */ | ||||
| 	LBA_t	fatbase;		/* FAT base sector */ | ||||
| 	LBA_t	dirbase;		/* Root directory base sector (FAT12/16) or cluster (FAT32/exFAT) */ | ||||
| 	LBA_t	database;		/* Data base sector */ | ||||
| #if FF_FS_EXFAT | ||||
| 	LBA_t	bitbase;		/* Allocation bitmap base sector */ | ||||
| 	BYTE	*dirbuf;		/* Directory entry block scratchpad buffer for exFAT */ | ||||
| 	DWORD	cdc_scl;		/* Containing directory start cluster (invalid when cdir is 0) */ | ||||
| 	DWORD	cdc_size;		/* b31-b8:Size of containing directory, b7-b0: Chain status */ | ||||
| 	DWORD	cdc_ofs;		/* Offset in the containing directory (invalid when cdir is 0) */ | ||||
| #endif | ||||
| 	LBA_t	winsect;		/* Current sector appearing in the win[] */ | ||||
| 	BYTE	win[FF_MAX_SS];	/* Disk access window for Directory, FAT (and file data at tiny cfg) */ | ||||
| } FATFS; | ||||
| 
 | ||||
| @ -190,7 +186,7 @@ typedef struct { | ||||
| 	DWORD	n_frag;			/* Size of last fragment needs to be written to FAT (valid when not zero) */ | ||||
| 	DWORD	c_scl;			/* Containing directory start cluster (valid when sclust != 0) */ | ||||
| 	DWORD	c_size;			/* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */ | ||||
| 	DWORD	c_ofs;			/* Offset in the containing directory (valid when file object and sclust != 0) */ | ||||
| 	DWORD	c_ofs;			/* Offset in the containing directory (valid when in file object and sclust != 0) */ | ||||
| #endif | ||||
| #if FF_FS_LOCK | ||||
| 	UINT	lockid;			/* File lock ID origin from 1 (index of file semaphore table Files[]) */ | ||||
| @ -247,6 +243,10 @@ typedef struct { | ||||
| 	FSIZE_t	fsize;			/* File size */ | ||||
| 	WORD	fdate;			/* Modified date */ | ||||
| 	WORD	ftime;			/* Modified time */ | ||||
| #if FF_FS_CRTIME | ||||
| 	WORD	crdate;			/* Created date */ | ||||
| 	WORD	crtime;			/* Created time */ | ||||
| #endif | ||||
| 	BYTE	fattrib;		/* File attribute */ | ||||
| #if FF_USE_LFN | ||||
| 	TCHAR	altname[FF_SFN_BUF + 1];/* Alternative file name */ | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| /  Configurations of FatFs Module | ||||
| /---------------------------------------------------------------------------*/ | ||||
| 
 | ||||
| #define FFCONF_DEF	5380	/* Revision ID */ | ||||
| #define FFCONF_DEF	5385	/* Revision ID */ | ||||
| 
 | ||||
| /*---------------------------------------------------------------------------/
 | ||||
| / Function Configurations | ||||
| @ -57,15 +57,15 @@ | ||||
| 
 | ||||
| 
 | ||||
| #define FF_USE_STRFUNC	0 | ||||
| #define FF_PRINT_LLI	0 | ||||
| #define FF_PRINT_FLOAT	0 | ||||
| #define FF_PRINT_LLI	1 | ||||
| #define FF_PRINT_FLOAT	1 | ||||
| #define FF_STRF_ENCODE	3 | ||||
| /* FF_USE_STRFUNC switches the string API functions, f_gets(), f_putc(), f_puts()
 | ||||
| /  and f_printf(). | ||||
| /* FF_USE_STRFUNC switches string API functions, f_gets(), f_putc(), f_puts() and
 | ||||
| /  f_printf(). | ||||
| / | ||||
| /   0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect. | ||||
| /   1: Enable without LF - CRLF conversion. | ||||
| /   2: Enable with LF - CRLF conversion. | ||||
| /   1: Enable without LF-CRLF conversion. | ||||
| /   2: Enable with LF-CRLF conversion. | ||||
| / | ||||
| /  FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2 | ||||
| /  makes f_printf() support floating point argument. These features want C99 or later. | ||||
| @ -238,9 +238,9 @@ | ||||
| 
 | ||||
| 
 | ||||
| #define FF_FS_NORTC		0 | ||||
| #define FF_NORTC_MON	11 | ||||
| #define FF_NORTC_MON	6 | ||||
| #define FF_NORTC_MDAY	1 | ||||
| #define FF_NORTC_YEAR	2024 | ||||
| #define FF_NORTC_YEAR	2025 | ||||
| /* The option FF_FS_NORTC switches timestamp feature. If the system does not have
 | ||||
| /  an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the | ||||
| /  timestamp feature. Every object modified by FatFs will have a fixed timestamp | ||||
| @ -251,9 +251,14 @@ | ||||
| /  These options have no effect in read-only configuration (FF_FS_READONLY = 1). */ | ||||
| 
 | ||||
| 
 | ||||
| #define FF_FS_CRTIME	0 | ||||
| /* This option enables(1)/disables(0) the timestamp of the file created. When
 | ||||
| /  set 1, the file created time is available in FILINFO structure. */ | ||||
| 
 | ||||
| 
 | ||||
| #define FF_FS_NOFSINFO	0 | ||||
| /* If you need to know correct free space on the FAT32 volume, set bit 0 of this
 | ||||
| /  option, and f_getfree() at the first time after volume mount will force | ||||
| /* If you need to know the correct free space on the FAT32 volume, set bit 0 of
 | ||||
| /  this option, and f_getfree() on the first time after volume mount will force | ||||
| /  a full FAT scan. Bit 1 controls the use of last allocated cluster number. | ||||
| / | ||||
| /  bit0=0: Use free cluster count in the FSINFO if available. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user