From 0eeda99a8cac1634b4a279549bf6d3f7833eb315 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Thu, 2 Feb 2017 12:24:38 +0200 Subject: [PATCH] pick better name for unregister function and update docs --- components/fatfs/src/esp_vfs_fat.h | 2 +- components/fatfs/src/vfs_fat.c | 4 ++-- components/fatfs/src/vfs_fat_sdmmc.c | 4 ++-- docs/api/storage/fatfs.rst | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/fatfs/src/esp_vfs_fat.h b/components/fatfs/src/esp_vfs_fat.h index 9c39198da3..4e27dce699 100644 --- a/components/fatfs/src/esp_vfs_fat.h +++ b/components/fatfs/src/esp_vfs_fat.h @@ -75,7 +75,7 @@ esp_err_t esp_vfs_fat_unregister() __attribute__((deprecated)); * - ESP_OK on success * - ESP_ERR_INVALID_STATE if FATFS is not registered in VFS */ -esp_err_t esp_vfs_fat_unregister_ctx(const char* base_path); +esp_err_t esp_vfs_fat_unregister_path(const char* base_path); /** * @brief Configuration arguments for esp_vfs_fat_sdmmc_mount function diff --git a/components/fatfs/src/vfs_fat.c b/components/fatfs/src/vfs_fat.c index 10e207482f..ecc3b1102c 100644 --- a/components/fatfs/src/vfs_fat.c +++ b/components/fatfs/src/vfs_fat.c @@ -147,7 +147,7 @@ esp_err_t esp_vfs_fat_register(const char* base_path, const char* fat_drive, siz return ESP_OK; } -esp_err_t esp_vfs_fat_unregister_ctx(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); if (ctx == _VOLUMES) { @@ -169,7 +169,7 @@ esp_err_t esp_vfs_fat_unregister() if (s_fat_ctx == NULL) { return ESP_ERR_INVALID_STATE; } - esp_err_t err = esp_vfs_fat_unregister_ctx(s_fat_ctx->base_path); + esp_err_t err = esp_vfs_fat_unregister_path(s_fat_ctx->base_path); if (err != ESP_OK) { return err; } diff --git a/components/fatfs/src/vfs_fat_sdmmc.c b/components/fatfs/src/vfs_fat_sdmmc.c index 16effdce27..ea6093633d 100644 --- a/components/fatfs/src/vfs_fat_sdmmc.c +++ b/components/fatfs/src/vfs_fat_sdmmc.c @@ -123,7 +123,7 @@ esp_err_t esp_vfs_fat_sdmmc_mount(const char* base_path, fail: free(workbuf); - esp_vfs_fat_unregister_ctx(base_path); + esp_vfs_fat_unregister_path(base_path); ff_diskio_unregister(pdrv); free(s_card); s_card = NULL; @@ -143,7 +143,7 @@ esp_err_t esp_vfs_fat_sdmmc_unmount() free(s_card); s_card = NULL; sdmmc_host_deinit(); - esp_err_t err = esp_vfs_fat_unregister_ctx(s_base_path); + esp_err_t err = esp_vfs_fat_unregister_path(s_base_path); free(s_base_path); s_base_path = NULL; return err; diff --git a/docs/api/storage/fatfs.rst b/docs/api/storage/fatfs.rst index d2efc87abf..6dd04ae3e6 100644 --- a/docs/api/storage/fatfs.rst +++ b/docs/api/storage/fatfs.rst @@ -8,7 +8,7 @@ Additionally, FatFs has been modified to support run-time pluggable disk IO laye Using FatFs with VFS -------------------- -``esp_vfs_fat.h`` header file defines functions to connect FatFs with VFS. ``esp_vfs_fat_register`` function allocates a ``FATFS`` structure, and registers a given path prefix in VFS. Subsequent operations on files starting with this prefix are forwarded to FatFs APIs. ``esp_vfs_fat_unregister`` function deletes the registration with VFS, and frees the ``FATFS`` structure. +``esp_vfs_fat.h`` header file defines functions to connect FatFs with VFS. ``esp_vfs_fat_register`` function allocates a ``FATFS`` structure, and registers a given path prefix in VFS. Subsequent operations on files starting with this prefix are forwarded to FatFs APIs. ``esp_vfs_fat_unregister_path`` function deletes the registration with VFS, and frees the ``FATFS`` structure. Most applications will use the following flow when working with ``esp_vfs_fat_`` functions: @@ -28,12 +28,12 @@ Most applications will use the following flow when working with ``esp_vfs_fat_`` 8. Call ``ff_diskio_register`` with NULL ``ff_diskio_impl_t*`` argument and the same drive number. -9. Call ``esp_vfs_fat_unregister`` to remove FatFs from VFS, and free the ``FATFS`` structure allocated on step 1. +9. Call ``esp_vfs_fat_unregister_path`` with the path where the file system is mounted to remove FatFs from VFS, and free the ``FATFS`` structure allocated on step 1. Convenience functions, ``esp_vfs_fat_sdmmc_mount`` and ``esp_vfs_fat_sdmmc_unmount``, which wrap these steps and also handle SD card initialization, are described in the next section. .. doxygenfunction:: esp_vfs_fat_register -.. doxygenfunction:: esp_vfs_fat_unregister +.. doxygenfunction:: esp_vfs_fat_unregister_path Using FatFs with VFS and SD cards -- 2.40.0