Commit Graph

72 Commits

Author SHA1 Message Date
Adam Múdry
a1f493b50f fix(vfs): FATFS mount immediately after format if mount failed 2024-07-23 15:44:40 +02:00
sonika.rathi
8e3e642db4 fix(fatfs): fix memory overlapping issue in vfs_fat.c 2024-05-22 13:06:59 +02:00
sonika.rathi
a1e06ebab0 fix(vfs): fix coverity issue copy of overlapping memory in vfs_fat.c 2024-05-06 13:57:08 +02:00
Sonika Rathi
e17da6f9f9 fix(fatfs): Optimizes vfs_fat_stat function to get stat structure after readdir
Closes https://github.com/espressif/esp-idf/issues/10220
2024-04-22 09:07:15 +02:00
Tomáš Rohlínek
f398b7923a
fix(storage/fatfs): fix double mouting of spiflash 2024-04-12 10:26:22 +02:00
Ivan Grokhotkov
10cc15b150
fix(storage): applied spelling fixes by codespell pre-commit hook 2024-03-28 13:00:54 +01:00
Adam Múdry
40de3816ec fix(fatfs): Fix leak of malloced FIL struct
In esp_vfs_fat_create_contiguous_file and esp_vfs_fat_test_contiguous_file functions
2024-03-12 13:25:09 +01:00
Adam Múdry
b76123af06 Merge branch 'feature/fatfs_expand_files_api' into 'master'
feat(fatfs): Allow expanding files with seeking and truncating functions

Closes IDFGH-12035

See merge request espressif/esp-idf!28945
2024-03-04 20:56:44 +08:00
Adam Múdry
35e312c48e feat(fatfs): Allow expanding files with seeking and truncating functions
Closes https://github.com/espressif/esp-idf/issues/13100
2024-02-29 01:01:32 +01:00
Adam Múdry
8d3e79971e feat(fatfs): Add f_expand function as esp_vfs_fat_create_contiguous_file
Add esp_vfs_fat_test_contiguous_file to test it
2024-02-22 16:05:28 +01:00
Marius Vikhammer
af6657b43b fix(fatfs): temp remove deprecated attribute from esp_vfs_fat_register
Causes build-errors internally in CI, should deprecate after external
components have been upgraded
2024-02-22 17:48:32 +08:00
Adam Múdry
5f961537cc feat(storage/fatfs): Switch to a config struct for VFS FAT registration 2024-02-19 14:05:50 +01:00
Adam Múdry
88e4fd9ac1 fix(vfs): Add missing lock release in vfs_fat_truncate 2024-02-08 14:16:19 +01:00
Adam Múdry
376ea7e4ed feat(fatfs): VFS FATFS add format functions with config argument 2024-01-29 15:09:50 +08:00
Adam Múdry
8e50d63fea feat(fatfs): Add an option to use 2 FATs (file allocation tables) in FATFS volumes
Should help with redundancy and data corruption when enabled but uses more space.
2024-01-18 14:03:28 +01:00
Adam Múdry
29c30b961d fix: esp_vfs_fat_sdcard_format workbuf memory leak 2023-11-29 12:39:15 +01:00
Tomáš Rohlínek
91e158aa0c
fix(storage/fatfs): add missing locks in fatfs wrapper for vfs 2023-11-27 07:47:28 +01:00
Adam Múdry
25714837cf fix(storage): FATFS WL function formatting wrong partition
Closes https://github.com/espressif/esp-idf/issues/12542

Co-authored-by: Tony Stuart <anthonyfstuart@gmail.com>
2023-11-23 13:54:00 +01:00
Armando
5b8d904a9b refactor(sdmmc): dependency inversion to sdmmc component 2023-11-16 15:37:32 +08:00
Tomáš Rohlínek
3f4698ac47
fix(storage/fatfs): add missing lock release introduced by IMMEDIATE_FSYNC 2023-10-30 10:22:08 +01:00
sonika.rathi
91eada4acc fix(fatfs): free allocated memory for base path before unmounting the card 2023-10-25 09:33:42 +02:00
Adam Múdry
0024867c3b Merge branch 'feature/add_optional_immediate_fsync' into 'master'
fatfs: add optional immediate fsync

See merge request espressif/esp-idf!26097
2023-10-16 17:37:22 +08:00
Adam Múdry
ab1eb37fe8 feat(partition_table): Add read-only partition flag and functionality 2023-10-11 00:01:05 +02:00
Tomáš Rohlínek
525776f748
feat(vfs/fatfs): Add option for automatic immediate fsync 2023-10-02 07:06:05 +02:00
Adam Múdry
ebde53bbb9 docs(fatfs): Move mentioned APIs to a separate API reference section 2023-08-04 23:47:44 +00:00
Sonika Rathi
b31b68fc68 bugfix: fix for fatfs "open("xx",O_CREAT|O_WRONLY,0666)" call failure
fatfs 'open' with only O_CREAT flag fails to creat new file

Closes https://github.com/espressif/esp-idf/issues/1817
2023-04-18 09:57:44 +05:30
Chip Weinberger
74d6215b7f [SDMMC] add reasonable timeouts to all while loops
Closes: https://github.com/espressif/esp-idf/pull/10532
2023-04-11 11:06:56 +00:00
Adam Múdry
16915556a3 fatfs: fstat - enable setting a custom preferred block size
Enables setting a custom st_blksize in fatfs vfs fstat function.
Directly affects file buffer size for fatfs.
Increasing the value helps with fread and fgets speeds, however increases heap usage.
Added info to docs about improving I/O performance.
2023-03-08 09:09:47 +01:00
Armando
0a472225cc fatfs: fix deadcode issue 2023-02-27 11:25:29 +00:00
Armando
d59fd3e529 fatfs: deprecate esp_vfs_fat_sdmmc_unmount
This API was deprecated before, but without deprecation warning and
migration doc. This commit added deprecation warning and migration doc
to it.
2023-02-16 14:17:51 +08:00
Armando
90a6018e67 fatfs: added an API to format FAT on sdcard 2023-02-16 14:17:51 +08:00
Armando
4150bfb403 fatfs: added an API to format FAT on spiflash 2023-02-16 12:19:35 +08:00
Armando
1bd8018a59 vfs_fat_spiflash: use esp_check 2023-02-14 09:22:17 +00:00
Ivan Grokhotkov
23e1ae1bc2
storage: fix and re-enable -Wformat warnings 2022-10-06 16:16:32 +02:00
John
aaf35889b6 Change placeholder in ESP_LOGD conditionally depending on FF_FS_EXFAT
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
2022-07-22 16:52:14 +01:00
Adam Múdry
0fac7d1c02 fatfs: Fix undefined ssize member of FATFS struct 2022-06-27 08:57:58 +00:00
Martin Vychodil
7f884dc966 Merge branch 'fix/ff_sdmmc_status_check_optional' into 'master'
fatfs: Add option to mock ff_sdmmc_status output to increase IO speed

Closes IDF-4788

See merge request espressif/esp-idf!18300
2022-06-13 14:42:12 +08:00
Matus Fabo
384d61f156 remove: sdspi_host deprecated api
add: migration guide documentation
2022-06-12 20:07:27 +00:00
Adam Múdry
8af790da45 fatfs: Add mock option to ff_sdmmc_status function to increase IO speed
Adds `disk_status_check_enable` field to `esp_vfs_fat_mount_config_t` struct to control if ff_sdmmc_status is mocked or not.
2022-06-09 20:09:32 +00:00
Ivan Grokhotkov
39238f51ce fatfs: fix incorrect mtime returned for files created during DST
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
2022-06-09 19:50:00 +00:00
Adam Múdry
2565acbc28 fatfs: Fix possible integer overflow in esp_vfs_fat_info() 2022-05-20 14:51:11 +02:00
Adam Múdry
22b46580f8 fatfs: add esp_vfs_fat_info() + unit tests 2022-04-15 20:49:53 +02:00
Matus Fabo
24268d47a2 change: renamed FATFS convenience mounting functions
change: renamed every instance of these functions
add: deprecation notice with old functions
change: CC0 licence to CC0-1.0 in fatfsgen_example_main.c
2022-04-11 08:44:40 +00:00
Vamshi Gajjela
66561f838d vfs: bugfix vfs_fat_write/pwrite upon disk-full
Closes https://github.com/espressif/esp-idf/issues/5027
2022-03-21 17:28:46 +00:00
Vamshi Gajjela
ea9f7cc370 fatfs: Add ftruncate api support for VFS and FAT-VFS
Unit test cases added to verify ftruncate within fatfs tests.

Closes https://github.com/espressif/esp-idf/issues/8279
2022-03-08 16:58:25 +05:30
Adam Múdry
bb8587a139 fatfs: Update to version 0.14b
Updated FATFS to 0.14b from 0.13c and patched for ESP32
2022-02-21 14:54:55 +01:00
hörbert
ed2a21e1c7
Don't return a hard coded errno in vfs_fat_access
Why should the return value of vfs_fat_access be hard coded as ENOENT?
This hides errors like FR_DISK_ERR of the lower layers.
2021-12-08 11:43:18 +01:00
Omar Chebib
63b96d7612 FAT: Number of volumes can now be configured through menuconfig
Closes https://github.com/espressif/esp-idf/issues/7513
2021-10-19 12:15:31 +08:00
aditi_lonkar
6e7780421b fatfs: Fix some memory leak issues by coverity static analyzer. 2021-01-25 03:37:47 +00:00
morris
e9c131e174 fatfs: return EINVAL if truncate length is less than 0 2021-01-13 19:11:48 +08:00