From bb305bd109d17a6d1697d6031044f58e9cf05f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Rohl=C3=ADnek?= Date: Thu, 31 Oct 2024 14:13:04 +0100 Subject: [PATCH] feat(storage/esp_vfs_console): move cdcacm driver to new vfs API --- .../include/esp_private/esp_vfs_cdcacm.h | 2 +- components/esp_vfs_console/vfs_cdcacm.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h b/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h index b93d1a4da0..d03b06b3fc 100644 --- a/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h +++ b/components/esp_vfs_console/include/esp_private/esp_vfs_cdcacm.h @@ -20,7 +20,7 @@ extern "C" { * * @return pointer to structure esp_vfs_t */ -const esp_vfs_t *esp_vfs_cdcacm_get_vfs(void); +const esp_vfs_fs_ops_t *esp_vfs_cdcacm_get_vfs(void); #ifdef __cplusplus } diff --git a/components/esp_vfs_console/vfs_cdcacm.c b/components/esp_vfs_console/vfs_cdcacm.c index 01545d96b5..98b3330d54 100644 --- a/components/esp_vfs_console/vfs_cdcacm.c +++ b/components/esp_vfs_console/vfs_cdcacm.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -300,8 +300,7 @@ void esp_vfs_dev_cdcacm_set_rx_line_endings(esp_line_endings_t mode) s_rx_mode = mode; } -static const esp_vfs_t vfs = { - .flags = ESP_VFS_FLAG_DEFAULT, +static const esp_vfs_fs_ops_t s_cdcacm_vfs = { .write = &cdcacm_write, .open = &cdcacm_open, .fstat = &cdcacm_fstat, @@ -311,12 +310,12 @@ static const esp_vfs_t vfs = { .fsync = &cdcacm_fsync }; -const esp_vfs_t *esp_vfs_cdcacm_get_vfs(void) +const esp_vfs_fs_ops_t *esp_vfs_cdcacm_get_vfs(void) { - return &vfs; + return &s_cdcacm_vfs; } esp_err_t esp_vfs_dev_cdcacm_register(void) { - return esp_vfs_register("/dev/cdcacm", &vfs, NULL); + return esp_vfs_register_fs("/dev/cdcacm", &s_cdcacm_vfs, ESP_VFS_FLAG_STATIC, NULL); }