From 24268d47a2dbef7ca65588f40721e9f4e4a33fee Mon Sep 17 00:00:00 2001 From: Matus Fabo Date: Fri, 4 Mar 2022 20:15:49 +0100 Subject: [PATCH] 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 --- components/fatfs/test/test_fatfs_rawflash.c | 22 +++---- components/fatfs/test/test_fatfs_sdmmc.c | 8 +-- components/fatfs/test/test_fatfs_spiflash.c | 8 +-- components/fatfs/vfs/esp_vfs_fat.h | 58 ++++++++++--------- components/fatfs/vfs/vfs_fat_spiflash.c | 28 +++++++-- components/vfs/test/test_vfs_access.c | 22 +++---- components/vfs/test/test_vfs_append.c | 22 +++---- components/vfs/test/test_vfs_select.c | 4 +- docs/en/api-reference/storage/fatfs.rst | 6 +- .../api-reference/storage/wear-levelling.rst | 4 +- docs/zh_CN/api-reference/storage/fatfs.rst | 6 +- .../api-reference/storage/wear-levelling.rst | 4 +- .../main/ble_mesh_console_main.c | 2 +- .../cmake/import_lib/main/main.cpp | 2 +- .../iperf/main/ethernet_example_main.c | 2 +- .../main/simple_sniffer_example_main.c | 2 +- .../i2c_tools/main/i2ctools_example_main.c | 2 +- .../main/ext_flash_fatfs_example_main.c | 2 +- .../fatfsgen/main/fatfsgen_example_main.c | 8 +-- examples/storage/wear_levelling/README.md | 2 +- .../main/wear_levelling_example_main.c | 4 +- .../advanced/main/console_example_main.c | 2 +- .../console/basic/main/console_example_main.c | 2 +- tools/ci/check_copyright_ignore.txt | 4 -- 24 files changed, 109 insertions(+), 117 deletions(-) diff --git a/components/fatfs/test/test_fatfs_rawflash.c b/components/fatfs/test/test_fatfs_rawflash.c index 882c4f8312..12d4b272e0 100644 --- a/components/fatfs/test/test_fatfs_rawflash.c +++ b/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 #include @@ -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]") diff --git a/components/fatfs/test/test_fatfs_sdmmc.c b/components/fatfs/test/test_fatfs_sdmmc.c index 62b77d922c..bd8356ea7c 100644 --- a/components/fatfs/test/test_fatfs_sdmmc.c +++ b/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)); } /* diff --git a/components/fatfs/test/test_fatfs_spiflash.c b/components/fatfs/test/test_fatfs_spiflash.c index df8db0457a..bed03a19f0 100644 --- a/components/fatfs/test/test_fatfs_spiflash.c +++ b/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]") diff --git a/components/fatfs/vfs/esp_vfs_fat.h b/components/fatfs/vfs/esp_vfs_fat.h index a3ffe387ac..60b985d5c4 100644 --- a/components/fatfs/vfs/esp_vfs_fat.h +++ b/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 @@ -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 } diff --git a/components/fatfs/vfs/vfs_fat_spiflash.c b/components/fatfs/vfs/vfs_fat_spiflash.c index 650744b520..b388e45a90 100644 --- a/components/fatfs/vfs/vfs_fat_spiflash.c +++ b/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"))); diff --git a/components/vfs/test/test_vfs_access.c b/components/vfs/test/test_vfs_access.c index e980526417..b8e30efabf 100644 --- a/components/vfs/test/test_vfs_access.c +++ b/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 #include @@ -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) diff --git a/components/vfs/test/test_vfs_append.c b/components/vfs/test/test_vfs_append.c index d12d334e02..80aa8e5f95 100644 --- a/components/vfs/test/test_vfs_append.c +++ b/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 #include @@ -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]") diff --git a/components/vfs/test/test_vfs_select.c b/components/vfs/test/test_vfs_select.c index a427594570..061bb07396 100644 --- a/components/vfs/test/test_vfs_select.c +++ b/components/vfs/test/test_vfs_select.c @@ -583,7 +583,7 @@ TEST_CASE("select() works with concurrent mount", "[vfs][fatfs]") start_select_task(¶m); 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(¶m); 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)); diff --git a/docs/en/api-reference/storage/fatfs.rst b/docs/en/api-reference/storage/fatfs.rst index d66b29b262..1133831d70 100644 --- a/docs/en/api-reference/storage/fatfs.rst +++ b/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 diff --git a/docs/en/api-reference/storage/wear-levelling.rst b/docs/en/api-reference/storage/wear-levelling.rst index f954f6d4f6..3878ed26ef 100644 --- a/docs/en/api-reference/storage/wear-levelling.rst +++ b/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 ----------------------- diff --git a/docs/zh_CN/api-reference/storage/fatfs.rst b/docs/zh_CN/api-reference/storage/fatfs.rst index e04e4f9022..e251d01a6b 100644 --- a/docs/zh_CN/api-reference/storage/fatfs.rst +++ b/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 层 diff --git a/docs/zh_CN/api-reference/storage/wear-levelling.rst b/docs/zh_CN/api-reference/storage/wear-levelling.rst index bd4e98ab99..fa7385f6a3 100644 --- a/docs/zh_CN/api-reference/storage/wear-levelling.rst +++ b/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 参考 ----------------------- diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c index 6c07dd22f9..b808f48cfb 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_console_main.c +++ b/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; } diff --git a/examples/build_system/cmake/import_lib/main/main.cpp b/examples/build_system/cmake/import_lib/main/main.cpp index 2241ea92dc..10278cde6f 100644 --- a/examples/build_system/cmake/import_lib/main/main.cpp +++ b/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; diff --git a/examples/ethernet/iperf/main/ethernet_example_main.c b/examples/ethernet/iperf/main/ethernet_example_main.c index 0103f5a342..e8d7fefd5b 100644 --- a/examples/ethernet/iperf/main/ethernet_example_main.c +++ b/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; diff --git a/examples/network/simple_sniffer/main/simple_sniffer_example_main.c b/examples/network/simple_sniffer/main/simple_sniffer_example_main.c index 107cd60d0b..1e12dde279 100644 --- a/examples/network/simple_sniffer/main/simple_sniffer_example_main.c +++ b/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; diff --git a/examples/peripherals/i2c/i2c_tools/main/i2ctools_example_main.c b/examples/peripherals/i2c/i2c_tools/main/i2ctools_example_main.c index 4e363215d5..5cb6a6e988 100644 --- a/examples/peripherals/i2c/i2c_tools/main/i2ctools_example_main.c +++ b/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; diff --git a/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c b/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c index 9c4e154801..f7995626d4 100644 --- a/examples/storage/ext_flash_fatfs/main/ext_flash_fatfs_example_main.c +++ b/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; diff --git a/examples/storage/fatfsgen/main/fatfsgen_example_main.c b/examples/storage/fatfsgen/main/fatfsgen_example_main.c index 57497ab165..21ead9e0a3 100644 --- a/examples/storage/fatfsgen/main/fatfsgen_example_main.c +++ b/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"); } diff --git a/examples/storage/wear_levelling/README.md b/examples/storage/wear_levelling/README.md index d0341f7443..a10dd4c55b 100644 --- a/examples/storage/wear_levelling/README.md +++ b/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), diff --git a/examples/storage/wear_levelling/main/wear_levelling_example_main.c b/examples/storage/wear_levelling/main/wear_levelling_example_main.c index d8cd85412b..f68f50ea25 100644 --- a/examples/storage/wear_levelling/main/wear_levelling_example_main.c +++ b/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"); } diff --git a/examples/system/console/advanced/main/console_example_main.c b/examples/system/console/advanced/main/console_example_main.c index 5ffcc241f7..82e5431cd4 100644 --- a/examples/system/console/advanced/main/console_example_main.c +++ b/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; diff --git a/examples/system/console/basic/main/console_example_main.c b/examples/system/console/basic/main/console_example_main.c index 0f4f8b7073..a67fb06314 100644 --- a/examples/system/console/basic/main/console_example_main.c +++ b/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; diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index d5b170d7ab..66a72e7a39 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/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