refactor(fatfs): Update esp_vfs_fat_register function prototype

to match esp_vfs_fat_register_cfg
This commit is contained in:
Adam Múdry
2025-09-16 14:56:59 +02:00
parent 006b95f384
commit 38256a6b11
3 changed files with 12 additions and 19 deletions
+5 -6
View File
@@ -68,7 +68,7 @@ typedef struct {
* - ESP_ERR_INVALID_STATE if esp_vfs_fat_register was already called
* - ESP_ERR_NO_MEM if not enough memory or too many VFSes already registered
*/
esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs);
esp_err_t esp_vfs_fat_register(const esp_vfs_fat_conf_t* conf, FATFS** out_fs);
/**
* @brief Un-register FATFS from VFS
@@ -449,14 +449,13 @@ esp_err_t esp_vfs_fat_create_contiguous_file(const char* base_path, const char*
*/
esp_err_t esp_vfs_fat_test_contiguous_file(const char* base_path, const char* full_path, bool* is_contiguous);
#ifndef CONFIG_IDF_TARGET_LINUX
/** @cond */
/**
* @deprecated Please use `esp_vfs_fat_register_cfg` instead
* @deprecated Please use `esp_vfs_fat_register` instead
*/
esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive,
size_t max_files, FATFS** out_fs);
esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs);
#ifndef CONFIG_IDF_TARGET_LINUX
/**
* @deprecated Please use `esp_vfs_fat_spiflash_mount_rw_wl` instead
*/
@@ -485,9 +484,9 @@ esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path,
*/
esp_err_t esp_vfs_fat_rawflash_unmount(const char* base_path, const char* partition_label)
__attribute__((deprecated("esp_vfs_fat_rawflash_unmount is deprecated, please use esp_vfs_fat_spiflash_unmount_ro instead")));
#endif
/** @endcond */
#endif
#ifdef __cplusplus
}
#endif
+3 -11
View File
@@ -138,16 +138,6 @@ static size_t find_unused_context_index(void)
return FF_VOLUMES;
}
esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive, size_t max_files, FATFS** out_fs)
{
esp_vfs_fat_conf_t conf = {
.base_path = base_path,
.fat_drive = fat_drive,
.max_files = max_files,
};
return esp_vfs_fat_register_cfg(&conf, out_fs);
}
#ifdef CONFIG_VFS_SUPPORT_DIR
static const esp_vfs_dir_ops_t s_vfs_fat_dir = {
.stat_p = &vfs_fat_stat,
@@ -185,7 +175,7 @@ static const esp_vfs_fs_ops_t s_vfs_fat = {
#endif // CONFIG_VFS_SUPPORT_DIR
};
esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs)
esp_err_t esp_vfs_fat_register(const esp_vfs_fat_conf_t* conf, FATFS** out_fs)
{
size_t ctx = find_context_index_by_path(conf->base_path);
if (ctx < FF_VOLUMES) {
@@ -236,6 +226,8 @@ esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_f
return ESP_OK;
}
esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs) __attribute__((alias("esp_vfs_fat_register")));
esp_err_t esp_vfs_fat_unregister_path(const char* base_path)
{
size_t ctx = find_context_index_by_path(base_path);
@@ -3,11 +3,13 @@ Storage
:link_to_translation:`zh_CN:[中文]`
Removed VFS SDMMC Deprecated API
--------------------------------
Breaking Changes
----------------
Deprecated ``esp_vfs_fat_sdmmc_unmount`` function is now removed. Please use ``esp_vfs_fat_sdcard_unmount`` instead.
Function prototype for ``esp_vfs_fat_register`` has been changed to match ``esp_vfs_fat_register_cfg`` function. ``esp_vfs_fat_register_cfg`` is now deprecated.
VFS
---