diff --git a/components/fatfs/Kconfig b/components/fatfs/Kconfig index b14a214668..445989e858 100644 --- a/components/fatfs/Kconfig +++ b/components/fatfs/Kconfig @@ -1,5 +1,12 @@ menu "FAT Filesystem support" + config FATFS_VOLUME_COUNT + int "Number of volumes" + default 2 + range 1 10 + help + Number of volumes (logical drives) to use. + choice FATFS_CHOOSE_CODEPAGE prompt "OEM Code Page" default FATFS_CODEPAGE_437 diff --git a/components/fatfs/diskio/diskio_wl.c b/components/fatfs/diskio/diskio_wl.c index 617236e8f7..31bb7d25e5 100644 --- a/components/fatfs/diskio/diskio_wl.c +++ b/components/fatfs/diskio/diskio_wl.c @@ -1,16 +1,8 @@ -// Copyright 2015-2017 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-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include "diskio_impl.h" @@ -24,8 +16,7 @@ static const char* TAG = "ff_diskio_spiflash"; wl_handle_t ff_wl_handles[FF_VOLUMES] = { - WL_INVALID_HANDLE, - WL_INVALID_HANDLE, + [0 ... FF_VOLUMES - 1] = WL_INVALID_HANDLE }; DSTATUS ff_wl_initialize (BYTE pdrv) diff --git a/components/fatfs/src/ffconf.h b/components/fatfs/src/ffconf.h index 6578122c5f..4eb335a9be 100644 --- a/components/fatfs/src/ffconf.h +++ b/components/fatfs/src/ffconf.h @@ -181,7 +181,7 @@ / Drive/Volume Configurations /---------------------------------------------------------------------------*/ -#define FF_VOLUMES 2 +#define FF_VOLUMES CONFIG_FATFS_VOLUME_COUNT /* Number of volumes (logical drives) to be used. (1-10) */ diff --git a/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h b/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h index 82426319bd..038f910ff0 100644 --- a/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h +++ b/components/fatfs/test_fatfs_host/sdkconfig/sdkconfig.h @@ -11,3 +11,5 @@ #define CONFIG_ESPTOOLPY_FLASHSIZE "8MB" //currently use the legacy implementation, since the stubs for new HAL are not done yet #define CONFIG_SPI_FLASH_USE_LEGACY_IMPL 1 + +#define CONFIG_FATFS_VOLUME_COUNT 2 diff --git a/components/fatfs/vfs/vfs_fat.c b/components/fatfs/vfs/vfs_fat.c index 1ce28a1670..37e060abcd 100644 --- a/components/fatfs/vfs/vfs_fat.c +++ b/components/fatfs/vfs/vfs_fat.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-2021 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include #include @@ -92,7 +84,7 @@ static int vfs_fat_truncate(void* ctx, const char *path, off_t length); static int vfs_fat_utime(void* ctx, const char *path, const struct utimbuf *times); #endif // CONFIG_VFS_SUPPORT_DIR -static vfs_fat_ctx_t* s_fat_ctxs[FF_VOLUMES] = { NULL, NULL }; +static vfs_fat_ctx_t* s_fat_ctxs[FF_VOLUMES] = { NULL }; //backwards-compatibility with esp_vfs_fat_unregister() static vfs_fat_ctx_t* s_fat_ctx = NULL; diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 18cb799b01..d1c0aac8ce 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -1244,7 +1244,6 @@ components/fatfs/diskio/diskio_rawflash.c components/fatfs/diskio/diskio_rawflash.h components/fatfs/diskio/diskio_sdmmc.c components/fatfs/diskio/diskio_sdmmc.h -components/fatfs/diskio/diskio_wl.c components/fatfs/diskio/diskio_wl.h components/fatfs/port/freertos/ffsystem.c components/fatfs/port/linux/ffsystem.c @@ -1264,7 +1263,6 @@ 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.c components/fatfs/vfs/vfs_fat_internal.h components/fatfs/vfs/vfs_fat_sdmmc.c components/fatfs/vfs/vfs_fat_spiflash.c