refactor(fatfs): Update esp_vfs_fat_register function prototype

to match esp_vfs_fat_register_cfg
This commit is contained in:
Adam Múdry
2026-02-20 13:07:09 +01:00
parent 121b95ef75
commit 092a5ba5a5
3 changed files with 12 additions and 17 deletions
+5 -4
View File
@@ -66,7 +66,7 @@ typedef struct {
* - ESP_ERR_INVALID_STATE if esp_vfs_fat_register was already called * - 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_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 * @brief Un-register FATFS from VFS
@@ -446,11 +446,11 @@ esp_err_t esp_vfs_fat_test_contiguous_file(const char* base_path, const char* fu
/** @cond */ /** @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, esp_err_t esp_vfs_fat_register_cfg(const esp_vfs_fat_conf_t* conf, FATFS** out_fs);
size_t max_files, FATFS** out_fs);
#ifndef CONFIG_IDF_TARGET_LINUX
/** /**
* @deprecated Please use `esp_vfs_fat_spiflash_mount_rw_wl` instead * @deprecated Please use `esp_vfs_fat_spiflash_mount_rw_wl` instead
*/ */
@@ -479,6 +479,7 @@ 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) 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"))); __attribute__((deprecated("esp_vfs_fat_rawflash_unmount is deprecated, please use esp_vfs_fat_spiflash_unmount_ro instead")));
#endif
/** @endcond */ /** @endcond */
#ifdef __cplusplus #ifdef __cplusplus
+3 -11
View File
@@ -138,16 +138,6 @@ static size_t find_unused_context_index(void)
return FF_VOLUMES; 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 #ifdef CONFIG_VFS_SUPPORT_DIR
static const esp_vfs_dir_ops_t s_vfs_fat_dir = { static const esp_vfs_dir_ops_t s_vfs_fat_dir = {
.stat_p = &vfs_fat_stat, .stat_p = &vfs_fat_stat,
@@ -185,7 +175,7 @@ static const esp_vfs_fs_ops_t s_vfs_fat = {
#endif // CONFIG_VFS_SUPPORT_DIR #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); size_t ctx = find_context_index_by_path(conf->base_path);
if (ctx < FF_VOLUMES) { 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; 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) esp_err_t esp_vfs_fat_unregister_path(const char* base_path)
{ {
size_t ctx = find_context_index_by_path(base_path); size_t ctx = find_context_index_by_path(base_path);
@@ -3,11 +3,13 @@ Storage
:link_to_translation:`zh_CN:[中文]` :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. 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 VFS
--- ---