In case of using EXFAT by setting in ffconf.h:
the type FSIZE_t is changing from 4 to 8 bytes.
As a result, ESP_LOGD() in vfs_fat_lseek() does not compile:
error: format '%d' expects argument of type 'int', but argument 8 has type 'FSIZE_t' {aka 'long long unsigned int'} [-Werror=format=]
ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%d", __func__, new_pos, f_size(file));
To solve the problem we need to change %d with %lld conditionally, depending on FF_FS_EXFAT.
Closes https://github.com/espressif/esp-idf/pull/9361
mktime function uses tm_isdst member as an indicator whether the time
stamp is expected to be in daylight saving time (1) or not (0).
FAT filesystem uses local time as mtime, so no information about DST
is available from the filesystem.
According to mktime documentation, tm_isdst can be set to -1, in which
case the C library will try to determine if DST was or wasn't in
effect at that time, and will set UTC time accordingly.
Note that the conversion from UTC to local time and then back to UTC
(time_t -> localtime_r -> FAT timestamp -> mktime -> time_t) does not
always recover the same UTC time. In particular, the local time in the
hour before DST comes into effect can be interpreted as "before DST"
or "after DST", which would correspond to different UTC values. In
this case which option the C library chooses is undefined.
Closes https://github.com/espressif/esp-idf/issues/9039
Originally reported in https://github.com/espressif/arduino-esp32/issues/6786
FatFS library can sometimes return FR_INT_ERR if the filesystem is
corrupted. Propagate the error from VFS functions instead of
asserting, so that the application can handle the error. Also handle
the error during initialization of FatFS and format the filesystem if
it occurs.
This is a breaking change: applications which used diskio.h to
call ff_diskio_register, will now need to include diskio_impl.h.
Including diskio.h will include the original diskio.h header from
FatFS library.