瀏覽代碼

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

Matus Fabo 3 年之前
父節點
當前提交
24268d47a2

+ 7 - 15
components/fatfs/test/test_fatfs_rawflash.c

@@ -1,16 +1,8 @@
-// Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -58,12 +50,12 @@ static void test_setup(size_t max_files)
         }
     }
 
-    TEST_ESP_OK(esp_vfs_fat_rawflash_mount("/spiflash", "flash_test", &mount_config));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_ro("/spiflash", "flash_test", &mount_config));
 }
 
 static void test_teardown(void)
 {
-    TEST_ESP_OK(esp_vfs_fat_rawflash_unmount("/spiflash","flash_test"));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_ro("/spiflash","flash_test"));
 }
 
 TEST_CASE("(raw) can read file", "[fatfs]")

+ 4 - 4
components/fatfs/test/test_fatfs_sdmmc.c

@@ -268,12 +268,12 @@ TEST_CASE("(SD) mount two FAT partitions, SDMMC and WL, at the same time", "[fat
     /* Mount FATFS in SD can WL at the same time. Create a file on each FS */
     wl_handle_t wl_handle = WL_INVALID_HANDLE;
     test_setup();
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &wl_handle));
     unlink(filename_sd);
     unlink(filename_wl);
     test_fatfs_create_file_with_text(filename_sd, str_sd);
     test_fatfs_create_file_with_text(filename_wl, str_wl);
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", wl_handle));
     test_teardown();
 
     /* Check that the file "sd.txt" was created on FS in SD, and has the right data */
@@ -288,14 +288,14 @@ TEST_CASE("(SD) mount two FAT partitions, SDMMC and WL, at the same time", "[fat
     test_teardown();
 
     /* Check that the file "wl.txt" was created on FS in WL, and has the right data */
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &wl_handle));
     TEST_ASSERT_NULL(fopen(filename_sd, "r"));
     f = fopen(filename_wl, "r");
     TEST_ASSERT_NOT_NULL(f);
     TEST_ASSERT_NOT_NULL(fgets(buf, sizeof(buf) - 1, f));
     TEST_ASSERT_EQUAL(0, strcmp(buf, str_wl));
     fclose(f);
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", wl_handle));
 }
 
 /*

+ 4 - 4
components/fatfs/test/test_fatfs_spiflash.c

@@ -31,12 +31,12 @@ static void test_setup(void)
         .max_files = 5
     };
 
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &s_test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &s_test_wl_handle));
 }
 
 static void test_teardown(void)
 {
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", s_test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", s_test_wl_handle));
 }
 
 TEST_CASE("(WL) can format partition", "[fatfs][wear_levelling]")
@@ -84,9 +84,9 @@ TEST_CASE("(WL) can open maximum number of files", "[fatfs][wear_levelling]")
         .format_if_mount_failed = true,
         .max_files = max_files
     };
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &s_test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &s_test_wl_handle));
     test_fatfs_open_max_files("/spiflash/f", max_files);
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", s_test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", s_test_wl_handle));
 }
 
 TEST_CASE("(WL) overwrite and append file", "[fatfs][wear_levelling]")

+ 31 - 27
components/fatfs/vfs/esp_vfs_fat.h

@@ -1,16 +1,8 @@
-// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #pragma once
 #include <stddef.h>
@@ -70,7 +62,7 @@ esp_err_t esp_vfs_fat_unregister_path(const char* base_path);
 
 
 /**
- * @brief Configuration arguments for esp_vfs_fat_sdmmc_mount and esp_vfs_fat_spiflash_mount functions
+ * @brief Configuration arguments for esp_vfs_fat_sdmmc_mount and esp_vfs_fat_spiflash_mount_rw_wl functions
  */
 typedef struct {
     /**
@@ -204,7 +196,7 @@ esp_err_t esp_vfs_fat_sdmmc_unmount(void);
  *      - ESP_ERR_INVALID_ARG if the card argument is unregistered
  *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount hasn't been called
  */
-esp_err_t esp_vfs_fat_sdcard_unmount(const char *base_path, sdmmc_card_t *card);
+esp_err_t esp_vfs_fat_sdcard_unmount(const char* base_path, sdmmc_card_t *card);
 
 /**
  * @brief Convenience function to initialize FAT filesystem in SPI flash and register it in VFS
@@ -227,28 +219,27 @@ esp_err_t esp_vfs_fat_sdcard_unmount(const char *base_path, sdmmc_card_t *card);
  * @return
  *      - ESP_OK on success
  *      - ESP_ERR_NOT_FOUND if the partition table does not contain FATFS partition with given label
- *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount was already called
+ *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount_rw_wl was already called
  *      - ESP_ERR_NO_MEM if memory can not be allocated
  *      - ESP_FAIL if partition can not be mounted
  *      - other error codes from wear levelling library, SPI flash driver, or FATFS drivers
  */
-esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
+esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path,
     const char* partition_label,
     const esp_vfs_fat_mount_config_t* mount_config,
     wl_handle_t* wl_handle);
 
 /**
- * @brief Unmount FAT filesystem and release resources acquired using esp_vfs_fat_spiflash_mount
+ * @brief Unmount FAT filesystem and release resources acquired using esp_vfs_fat_spiflash_mount_rw_wl
  *
  * @param base_path  path where partition should be registered (e.g. "/spiflash")
- * @param wl_handle  wear levelling driver handle returned by esp_vfs_fat_spiflash_mount
+ * @param wl_handle  wear levelling driver handle returned by esp_vfs_fat_spiflash_mount_rw_wl
  *
  * @return
  *      - ESP_OK on success
- *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount hasn't been called
+ *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount_rw_wl hasn't been called
  */
- esp_err_t esp_vfs_fat_spiflash_unmount(const char* base_path, wl_handle_t wl_handle);
-
+esp_err_t esp_vfs_fat_spiflash_unmount_rw_wl(const char* base_path, wl_handle_t wl_handle);
 
 /**
  * @brief Convenience function to initialize read-only FAT filesystem and register it in VFS
@@ -268,27 +259,40 @@ esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
  * @return
  *      - ESP_OK on success
  *      - ESP_ERR_NOT_FOUND if the partition table does not contain FATFS partition with given label
- *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_rawflash_mount was already called for the same partition
+ *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount_ro was already called for the same partition
  *      - ESP_ERR_NO_MEM if memory can not be allocated
  *      - ESP_FAIL if partition can not be mounted
  *      - other error codes from SPI flash driver, or FATFS drivers
  */
-esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path,
+esp_err_t esp_vfs_fat_spiflash_mount_ro(const char* base_path,
     const char* partition_label,
     const esp_vfs_fat_mount_config_t* mount_config);
 
 /**
- * @brief Unmount FAT filesystem and release resources acquired using esp_vfs_fat_rawflash_mount
+ * @brief Unmount FAT filesystem and release resources acquired using esp_vfs_fat_spiflash_mount_ro
  *
  * @param base_path  path where partition should be registered (e.g. "/spiflash")
  * @param partition_label label of partition to be unmounted
  *
  * @return
  *      - ESP_OK on success
- *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount hasn't been called
+ *      - ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount_rw_wl hasn't been called
  */
- esp_err_t esp_vfs_fat_rawflash_unmount(const char* base_path, const char* partition_label);
+esp_err_t esp_vfs_fat_spiflash_unmount_ro(const char* base_path, const char* partition_label);
 
+esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
+    const char* partition_label,
+    const esp_vfs_fat_mount_config_t* mount_config,
+    wl_handle_t* wl_handle)
+    __attribute__((deprecated("esp_vfs_fat_spiflash_mount is deprecated, please use esp_vfs_fat_spiflash_mount_rw_wl instead")));
+esp_err_t esp_vfs_fat_spiflash_unmount(const char* base_path, wl_handle_t wl_handle)
+    __attribute__((deprecated("esp_vfs_fat_spiflash_unmount is deprecated, please use esp_vfs_fat_spiflash_unmount_rw_wl instead")));
+esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path,
+    const char* partition_label,
+    const esp_vfs_fat_mount_config_t* mount_config)
+    __attribute__((deprecated("esp_vfs_fat_rawflash_mount is deprecated, please use esp_vfs_fat_spiflash_mount_ro instead")));
+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")));
 
 #ifdef __cplusplus
 }

+ 22 - 6
components/fatfs/vfs/vfs_fat_spiflash.c

@@ -17,8 +17,9 @@
 #include "wear_levelling.h"
 #include "diskio_wl.h"
 
-static const char *TAG = "vfs_fat_spiflash";
-esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
+static const char* TAG = "vfs_fat_spiflash";
+
+esp_err_t esp_vfs_fat_spiflash_mount_rw_wl(const char* base_path,
     const char* partition_label,
     const esp_vfs_fat_mount_config_t* mount_config,
     wl_handle_t* wl_handle)
@@ -108,7 +109,7 @@ fail:
     return result;
 }
 
-esp_err_t esp_vfs_fat_spiflash_unmount(const char *base_path, wl_handle_t wl_handle)
+esp_err_t esp_vfs_fat_spiflash_unmount_rw_wl(const char* base_path, wl_handle_t wl_handle)
 {
     BYTE pdrv = ff_diskio_get_pdrv_wl(wl_handle);
     if (pdrv == 0xff) {
@@ -126,7 +127,8 @@ esp_err_t esp_vfs_fat_spiflash_unmount(const char *base_path, wl_handle_t wl_han
     return err;
 }
 
-esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path,
+
+esp_err_t esp_vfs_fat_spiflash_mount_ro(const char* base_path,
     const char* partition_label,
     const esp_vfs_fat_mount_config_t* mount_config)
 {
@@ -178,8 +180,7 @@ fail:
     return result;
 }
 
-
-esp_err_t esp_vfs_fat_rawflash_unmount(const char *base_path, const char* partition_label)
+esp_err_t esp_vfs_fat_spiflash_unmount_ro(const char* base_path, const char* partition_label)
 {
     const esp_partition_t *data_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
             ESP_PARTITION_SUBTYPE_DATA_FAT, partition_label);
@@ -200,3 +201,18 @@ esp_err_t esp_vfs_fat_rawflash_unmount(const char *base_path, const char* partit
     esp_err_t err = esp_vfs_fat_unregister_path(base_path);
     return err;
 }
+
+
+esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
+    const char* partition_label,
+    const esp_vfs_fat_mount_config_t* mount_config,
+    wl_handle_t* wl_handle)
+    __attribute__((alias("esp_vfs_fat_spiflash_mount_rw_wl")));
+esp_err_t esp_vfs_fat_spiflash_unmount(const char* base_path, wl_handle_t wl_handle)
+    __attribute__((alias("esp_vfs_fat_spiflash_unmount_rw_wl")));
+esp_err_t esp_vfs_fat_rawflash_mount(const char* base_path,
+    const char* partition_label,
+    const esp_vfs_fat_mount_config_t* mount_config)
+    __attribute__((alias("esp_vfs_fat_spiflash_mount_ro")));
+esp_err_t esp_vfs_fat_rawflash_unmount(const char* base_path, const char* partition_label)
+    __attribute__((alias("esp_vfs_fat_spiflash_unmount_ro")));

+ 7 - 15
components/vfs/test/test_vfs_access.c

@@ -1,16 +1,8 @@
-// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #include <stdio.h>
 #include <unistd.h>
@@ -75,12 +67,12 @@ static inline void test_spi_flash_setup(void)
         .max_files = 5
     };
 
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle));
 }
 
 static inline void test_spi_flash_teardown(void)
 {
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", test_wl_handle));
 }
 
 static inline void test_fatfs_create_file(const char *name)

+ 7 - 15
components/vfs/test/test_vfs_append.c

@@ -1,16 +1,8 @@
-// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+/*
+ * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
 
 #include <unistd.h>
 #include <fcntl.h>
@@ -93,11 +85,11 @@ TEST_CASE("open() with O_APPEND on FATFS works well", "[vfs][FATFS]")
         .format_if_mount_failed = true,
         .max_files = 2
     };
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle));
 
     test_append("/spiflash/file.txt");
 
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", test_wl_handle));
 }
 
 TEST_CASE("open() with O_APPEND on SPIFFS works well", "[vfs][spiffs]")

+ 2 - 2
components/vfs/test/test_vfs_select.c

@@ -583,7 +583,7 @@ TEST_CASE("select() works with concurrent mount", "[vfs][fatfs]")
     start_select_task(&param);
     vTaskDelay(10 / portTICK_PERIOD_MS); //make sure the task has started and waits in select()
 
-    TEST_ESP_OK(esp_vfs_fat_spiflash_mount("/spiflash", NULL, &mount_config, &test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_mount_rw_wl("/spiflash", NULL, &mount_config, &test_wl_handle));
 
     TEST_ASSERT_EQUAL(pdTRUE, xSemaphoreTake(param.sem, 1500 / portTICK_PERIOD_MS));
 
@@ -596,7 +596,7 @@ TEST_CASE("select() works with concurrent mount", "[vfs][fatfs]")
     start_select_task(&param);
     vTaskDelay(10 / portTICK_PERIOD_MS); //make sure the task has started and waits in select()
 
-    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount("/spiflash", test_wl_handle));
+    TEST_ESP_OK(esp_vfs_fat_spiflash_unmount_rw_wl("/spiflash", test_wl_handle));
 
     TEST_ASSERT_EQUAL(pdTRUE, xSemaphoreTake(param.sem, 1500 / portTICK_PERIOD_MS));
 

+ 3 - 3
docs/en/api-reference/storage/fatfs.rst

@@ -66,10 +66,10 @@ The convenience function :cpp:func:`esp_vfs_fat_sdmmc_unmount` unmounts the file
 Using FatFs with VFS in read-only mode
 --------------------------------------
 
-The header file :component_file:`fatfs/vfs/esp_vfs_fat.h` also defines the convenience functions :cpp:func:`esp_vfs_fat_rawflash_mount` and :cpp:func:`esp_vfs_fat_rawflash_unmount`. These functions perform Steps 1-3 and 7-9 respectively for read-only FAT partitions. These are particularly helpful for data partitions written only once during factory provisioning which will not be changed by production application throughout the lifetime of the hardware.
+The header file :component_file:`fatfs/vfs/esp_vfs_fat.h` also defines the convenience functions :cpp:func:`esp_vfs_fat_spiflash_mount_ro` and :cpp:func:`esp_vfs_fat_spiflash_unmount_ro`. These functions perform Steps 1-3 and 7-9 respectively for read-only FAT partitions. These are particularly helpful for data partitions written only once during factory provisioning which will not be changed by production application throughout the lifetime of the hardware.
 
-.. doxygenfunction:: esp_vfs_fat_rawflash_mount
-.. doxygenfunction:: esp_vfs_fat_rawflash_unmount
+.. doxygenfunction:: esp_vfs_fat_spiflash_mount_ro
+.. doxygenfunction:: esp_vfs_fat_spiflash_unmount_ro
 
 
 FatFS disk IO layer

+ 2 - 2
docs/en/api-reference/storage/wear-levelling.rst

@@ -22,10 +22,10 @@ Header Files
 Functions
 ^^^^^^^^^
 
-.. doxygenfunction:: esp_vfs_fat_spiflash_mount
+.. doxygenfunction:: esp_vfs_fat_spiflash_mount_rw_wl
 .. doxygenstruct:: esp_vfs_fat_mount_config_t
     :members:
-.. doxygenfunction:: esp_vfs_fat_spiflash_unmount
+.. doxygenfunction:: esp_vfs_fat_spiflash_unmount_rw_wl
 
 Mid level API Reference
 -----------------------

+ 3 - 3
docs/zh_CN/api-reference/storage/fatfs.rst

@@ -66,10 +66,10 @@ FatFs 与 VFS 和 SD 卡配合使用
 FatFs 与 VFS 配合使用(只读模式下)
 --------------------------------------
 
-头文件 :component_file:`fatfs/vfs/esp_vfs_fat.h` 也定义了两个便捷函数 :cpp:func:`esp_vfs_fat_rawflash_mount` 和 :cpp:func:`esp_vfs_fat_rawflash_unmount`。上述两个函数分别对 FAT 只读分区执行步骤 1-3 和步骤 7-9。有些数据分区仅在工厂配置时写入一次,之后在整个硬件生命周期内都不会再有任何改动。利用上述两个函数处理这种数据分区非常方便。
+头文件 :component_file:`fatfs/vfs/esp_vfs_fat.h` 也定义了两个便捷函数 :cpp:func:`esp_vfs_fat_spiflash_mount_ro` 和 :cpp:func:`esp_vfs_fat_spiflash_unmount_ro`。上述两个函数分别对 FAT 只读分区执行步骤 1-3 和步骤 7-9。有些数据分区仅在工厂配置时写入一次,之后在整个硬件生命周期内都不会再有任何改动。利用上述两个函数处理这种数据分区非常方便。
 
-.. doxygenfunction:: esp_vfs_fat_rawflash_mount
-.. doxygenfunction:: esp_vfs_fat_rawflash_unmount
+.. doxygenfunction:: esp_vfs_fat_spiflash_mount_ro
+.. doxygenfunction:: esp_vfs_fat_spiflash_unmount_ro
 
 
 FatFs 磁盘 I/O 层

+ 2 - 2
docs/zh_CN/api-reference/storage/wear-levelling.rst

@@ -22,10 +22,10 @@
 函数
 ^^^^^^^^^
 
-.. doxygenfunction:: esp_vfs_fat_spiflash_mount
+.. doxygenfunction:: esp_vfs_fat_spiflash_mount_rw_wl
 .. doxygenstruct:: esp_vfs_fat_mount_config_t
     :members:
-.. doxygenfunction:: esp_vfs_fat_spiflash_unmount
+.. doxygenfunction:: esp_vfs_fat_spiflash_unmount_rw_wl
 
 中层 API 参考
 -----------------------

+ 1 - 1
examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c

@@ -28,7 +28,7 @@ static void initialize_filesystem(void)
         .max_files = 4,
         .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         return;
     }

+ 1 - 1
examples/build_system/cmake/import_lib/main/main.cpp

@@ -28,7 +28,7 @@ extern "C" void app_main(void)
     mount_config.format_if_mount_failed = true;
     mount_config.allocation_unit_size = CONFIG_WL_SECTOR_SIZE;
 
-    esp_err_t err = esp_vfs_fat_spiflash_mount(base_path, "storage", &mount_config, &s_wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(base_path, "storage", &mount_config, &s_wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 1 - 1
examples/ethernet/iperf/main/ethernet_example_main.c

@@ -30,7 +30,7 @@ static void initialize_filesystem(void)
         .max_files = 4,
         .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 1 - 1
examples/network/simple_sniffer/main/simple_sniffer_example_main.c

@@ -64,7 +64,7 @@ static void initialize_filesystem(void)
         .max_files = 4,
         .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(HISTORY_MOUNT_POINT, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(HISTORY_MOUNT_POINT, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 1 - 1
examples/peripherals/i2c/i2c_tools/main/i2ctools_example_main.c

@@ -30,7 +30,7 @@ static void initialize_filesystem(void)
         .max_files = 4,
         .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 1 - 1
examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c

@@ -166,7 +166,7 @@ static bool example_mount_fatfs(const char* partition_label)
             .format_if_mount_failed = true,
             .allocation_unit_size = CONFIG_WL_SECTOR_SIZE
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(base_path, partition_label, &mount_config, &s_wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(base_path, partition_label, &mount_config, &s_wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return false;

+ 4 - 4
examples/storage/fatfsgen/main/fatfsgen_example_main.c

@@ -45,9 +45,9 @@ void app_main(void)
     };
     esp_err_t err;
     if (EXAMPLE_FATFS_MODE_READ_ONLY){
-        err = esp_vfs_fat_rawflash_mount(base_path, "storage", &mount_config);
+        err = esp_vfs_fat_spiflash_mount_ro(base_path, "storage", &mount_config);
     } else {
-        err = esp_vfs_fat_spiflash_mount(base_path, "storage", &mount_config, &s_wl_handle);
+        err = esp_vfs_fat_spiflash_mount_rw_wl(base_path, "storage", &mount_config, &s_wl_handle);
     }
 
     if (err != ESP_OK) {
@@ -141,9 +141,9 @@ void app_main(void)
     // Unmount FATFS
     ESP_LOGI(TAG, "Unmounting FAT filesystem");
     if (EXAMPLE_FATFS_MODE_READ_ONLY){
-        ESP_ERROR_CHECK(esp_vfs_fat_rawflash_unmount(base_path, "storage"));
+        ESP_ERROR_CHECK(esp_vfs_fat_spiflash_unmount_ro(base_path, "storage"));
     } else {
-        ESP_ERROR_CHECK(esp_vfs_fat_spiflash_unmount(base_path, s_wl_handle));
+        ESP_ERROR_CHECK(esp_vfs_fat_spiflash_unmount_rw_wl(base_path, s_wl_handle));
     }
     ESP_LOGI(TAG, "Done");
 }

+ 1 - 1
examples/storage/wear_levelling/README.md

@@ -4,7 +4,7 @@
 
 This example demonstrates how to use wear levelling library and FATFS library to store files in a partition inside SPI flash. Example does the following steps:
 
-1. Use an "all-in-one" `esp_vfs_fat_spiflash_mount` function to:
+1. Use an "all-in-one" `esp_vfs_fat_spiflash_mount_rw_wl` function to:
     - find a partition in SPI flash,
     - initialize wear levelling library using this partition
     - mount FAT filesystem using FATFS library (and format the filesystem, if the filesystem can not be mounted),

+ 2 - 2
examples/storage/wear_levelling/main/wear_levelling_example_main.c

@@ -35,7 +35,7 @@ void app_main(void)
             .format_if_mount_failed = true,
             .allocation_unit_size = CONFIG_WL_SECTOR_SIZE
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(base_path, "storage", &mount_config, &s_wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(base_path, "storage", &mount_config, &s_wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;
@@ -69,7 +69,7 @@ void app_main(void)
 
     // Unmount FATFS
     ESP_LOGI(TAG, "Unmounting FAT filesystem");
-    ESP_ERROR_CHECK( esp_vfs_fat_spiflash_unmount(base_path, s_wl_handle));
+    ESP_ERROR_CHECK( esp_vfs_fat_spiflash_unmount_rw_wl(base_path, s_wl_handle));
 
     ESP_LOGI(TAG, "Done");
 }

+ 1 - 1
examples/system/console/advanced/main/console_example_main.c

@@ -44,7 +44,7 @@ static void initialize_filesystem(void)
             .max_files = 4,
             .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 1 - 1
examples/system/console/basic/main/console_example_main.c

@@ -44,7 +44,7 @@ static void initialize_filesystem(void)
             .max_files = 4,
             .format_if_mount_failed = true
     };
-    esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
+    esp_err_t err = esp_vfs_fat_spiflash_mount_rw_wl(MOUNT_PATH, "storage", &mount_config, &wl_handle);
     if (err != ESP_OK) {
         ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
         return;

+ 0 - 4
tools/ci/check_copyright_ignore.txt

@@ -755,11 +755,9 @@ components/fatfs/src/ff.h
 components/fatfs/src/ffconf.h
 components/fatfs/src/ffsystem.c
 components/fatfs/src/ffunicode.c
-components/fatfs/test/test_fatfs_rawflash.c
 components/fatfs/test_fatfs_host/main.cpp
 components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h
 components/fatfs/test_fatfs_host/test_fatfs.cpp
-components/fatfs/vfs/esp_vfs_fat.h
 components/fatfs/vfs/vfs_fat_internal.h
 components/freertos/FreeRTOS-Kernel-SMP/croutine.c
 components/freertos/FreeRTOS-Kernel-SMP/event_groups.c
@@ -1680,8 +1678,6 @@ components/usb/test/hcd/test_hcd_ctrl.c
 components/vfs/include/esp_vfs_common.h
 components/vfs/include/esp_vfs_eventfd.h
 components/vfs/include/esp_vfs_semihost.h
-components/vfs/test/test_vfs_access.c
-components/vfs/test/test_vfs_append.c
 components/vfs/test/test_vfs_lwip.c
 components/vfs/test/test_vfs_paths.c
 components/vfs/test/test_vfs_uart.c