History: fs_exfat

This page describes all changes made to the fs_exfat package, exFAT File System, since its release. This also covers the fs_exfat_safe package, SafeexFAT.


2.10 (2021-03-24, 16:56):

  • Fixed undefined macro and uninitialized variable warnings.

2.9 (2021-03-16, 12:02):

  • Implemented consecutive cluster finding to decrease fragmentation: it is used if multiple clusters are written using exfat_write().
  • Fixed compilation errors that occurred when 4 volumes were used.
  • Fixed exfat_get_volume_list() was fixed: it did not fill the list if list size was greater than count of volumes.
  • Fixed exfat_format() was fixed: it created invalid upcase table if sector size was greater than 512 bytes and exfat_format() was called twice.

2.8 (2021-02-10, 13:00):

  • Modified to be able to make use of media_drv_cache:
    • Size of cluster is set to media driver using IOCTL call.
    • Filesystem uses F_IOCTL_MSG_COPY_SECTOR IOCTL call if supported to speed up r+ mode in safe mode.
  • Compilation errors were fixed when safe mode was disabled  (EXFAT_ENABLE_SAFE).

2.7 (2021-02-02, 07:40):

  • exfat_volume_clean() function header fixed in api_exfat.h.

2.6r2 (2021-02-01, 16:00):

  • Design files moved to hcc/design/fs_exfat and hcc/design/fs_exfat_safe folders.

2.6 (2020-12-18, 10:37):

  • Bugfix: if file was extended with write and flush in safe mode "r+" and the flush operation was interrupted, it could result a file with larger  file size than the actual FAT chain.
  • Bugfix: if exfat_open(..., "w+") was interrupted in safe mode, it could generate cross-linked cluster chains.
  • exfat_read() and exfat_seek() return EXFAT_ERR_CHECK_NEEDED if file's FAT chain ends prematurely.

2.5 (2020-11-16, 11:10):

  • Volume clean and directory walker functions were implemented.
  • Volume becomes read-only in case of write error.
  • Deferring creation of safe log files in case of open mode 'r+':  log files are created on first write instead of writing them at file open.
  • Bugfix: no zero file handles generated anymore.
  • EXFAT_COVERAGE configuration option was removed.
  • Error is generated instead of PSP_ASSERT() in exfat_initvolume() and exfat_repair() if invalid safe log files found.

2.4 (2020-10-26, 12:00):

  • Improved handling of cache buffers: only modified sectors written.
  • Data loss could occur if count of sectors was greater than 1 for file content in config_exfat.c (default configuration is 1).
  • FAT reading was optimized: exfat_seek() is faster.
  • Cache configuration reworked: no need to define the total number of required cache buffers, cache sizes are defined on a volume basis.

2.3 (2020-09-22, 11:35):

  • Added support for FMW (File multiple write).
  • False positive error was fixed in exfat_getfreespace() which occurred when read error occurred during calculation (e.g. card removed).
  • Count of sectors is checked in cache configuration: it shall be power of two except for the upcase table.
  •  Files can be moved/renamed with NoFatChain bit 1.
  • exfat_stat() shows current file size if file is opened for writing, file size is changed, but not flushed.
  • Open mode "aw"/"wa" is treated as invalid mode.

2.2 (2020-08-19, 10:57):

  • Directory entries could get corrupted when multiple files were open in the same directory.
  • Directory size could be miscalculated in the directory entry of parent directory.
  • Compiler warnings were eliminated.

2.1 (2020-05-14, 13:02):

  • Unique file ID can be retrieved with exfat_stat() and exfat_fstat().
  • Members of t_exfat_space were renamed.

1.19 (2020-03-30, 14:46):

  • Added exfat_set_last_free_cluster() and exfat_get_last_cluster().

1.18 (2020-03-18, 10:50):

  • Bugfix: exfat_delvolume() could de-reference NULL-pointer if called multiple times.
  • Following functions could de-reference NULL pointer if it was called on non-initialized volume: exfat_getlabel()exfat_setlabel(), exfat_get_volume_info(), exfat_getfreespace(), exfat_opendir(), exfat_move(), exfat_exists(), exfat_remove()exfat_rename(), exfat_repair(), exfat_open(), exfat_open_nonsafe()exfat_mkdir(), exfat_rmdir(), exfat_chdir(), exfat_getattr()exfat_setattr(), exfat_settimestamp(), exfat_gettimestamp()exfat_truncate(), exfat_is_directory(), exfat_is_file(), exfat_filelength(), exfat_getcwd(), and exfat_getdcwd().

1.17 (2020-01-10, 09:47):

  • Code made compatible with MISRA-C:2012/AMD1/.
  • EXFAT_ENABLE_LAST_ACCESS_UPDATE results in a build error when safe mode is enabled as currently it is not possible to use this feature in safe mode.
  • Moved  sector and cache buffers to PSP. This means they can be aligned or placed in non-cacheable memory.

1.16 (2019-10-24, 10:37):

  • Bugfix: PSP_ASSERT() was executed when media error occurred in exfat_mkdir().

1.15 (2019-09-24, 13:12):

  • Removed EXFAT_SYSTEM_ARCH_64BIT configuration option: it was used to optimize performance but turned out to bring no additional benefit.
  • Bugfix: cross-linked clusters could appear when media was almost full or free clusters fragmented.
  • Bugfix: exfat_flush() could produce cross linked clusters in safe mode if file's content was overwritten in "r+"/"w+" mode.
  • Bugfix: EXFAT_REPAIR_NEEDED error could occur after exfat_format() if EXFAT_REPAIR_NEEDED state was earlier.

1.14 (2019-09-10, 14:10):

  • Bugfix: exfat_initvolume() failed when media has different sector size than earlier.
  • Eliminated compiler error which occurred when EXFAT_ENABLE_SAFE=0.

1.13 (2019-09-04, 14:19):

  • Safe exfat_remove_content() clears clusters even when operation is  interrupted.
  • Optimized cluster operations when file is overwritten using mode "r+" in safe mode.
  • Safe mode was implemented for exfat_setlabel().
  • exfat_format() is not writing default label.
  • Bugfix: filesystem may write data to wrong cluster when multiple volumes were used at the same time.

1.12 (2019-08-01, 12:59):

  • Added exfat_remove_content().
  • Bugfix: if file was opened for write ("r+") and for read ("r") with a different file handle, wrong data could be read with the second file handle in safe mode after overwriting the first cluster.

1.11 (2019-07-31, 08:22):

  • Implemented Safe mode for exfat_open() (..., "w"/"w+"/"r+") and exfat_write(), exfat_seek(), exfat_flush() and exfat_close() for the "w"/"w+"/"r+" modes.

1.10 (2019-07-11, 09:47):

  • Implemented Safe mode for exfat_mkdir(), exfat_rmdir(), exfat_remove(), exfat_move(), exfat_repair(), and exfat_ftruncate().
  • Safe exfat_ftruncate() works on file handles opened in append ("a" or "a+") mode.

1.9 (2019-07-09, 08:22):

  • Bugfix: exfat_mkdir() could create directory with cross-linked clusters when EXFAT_SAFE_ENABLED was 1. This caused that files or directories get lost in the parent directory and PSP_ASSERT macro was triggered.

1.8 (2019-07-03, 12:24):

  • Increased speed of exfat_format() and exfat_mkdir(). Size of sector buffer can be changed by using EXFAT_SECTOR_BUFFER_COUNT.

1.7 (2019-07-02, 07:16):

  • Bugfix: directory entries may have been written to wrong cluster if they were crossing cluster boundary, causing a created file to become unusable (read, erase, etc. failures).

1.6 (2019-06-27, 09:16):

  • Cluster sizes can be configured for exfat_format() in config_exfat.c.
  • Validity of FAT and first cluster of root directory is checked.
  • exfat_format() closes all opened files.
  • exfat_mkdir() returns EXFAT_ERR_MEDIA_WRITE_PROTECTED in write-protected state.
  • Implemented Safe mode for exfat_open(..., "a"/"a+"), exfat_write(), exfat_seek(), and exfat_close().
  • Introduced exfat_repair().

1.5 (2019-06-03, 10:57):

  • Module cannot be compiled with ISO C99 or older compilers due to Unicode string literals.
  • Upcase table parser reported error if upcase table contained 131072 bytes (current operating systems produce 5836 byte long upcase table).

1.4 (2019-04-25, 08:25):

  • When possible, multiple sector access is always used (previously it was only used when reading/writing more than a cluster size).

1.3 (2019-04-18, 06:36):

  • Compiler warning was eliminated: undefined macro was used.

1.2 (2019-03-28, 09:38):

  • exfat_getlabel(), exfat_setlabel(), exfat_getfreespace() check whether exfat_enter_task() was called.
  • Code optimized: old cache functions not compiled.
  • Calculations optimized: binary shifts used instead of division and multiplication.
  • FAT chain is always closed when extended.
  • Fixed calculation of file name's checksum: upcase letters are used.
  • Fixed upcase function's error handling: it could return error when no error occurred.
  • Not necessary to call exfat_enter_task() if EXFAT_MAX_TASK_COUNT is 1.


  • Initial release.