Skip to content

Commit 0fde156

Browse files
joerchannashif
authored andcommitted
fs: shell: Fix FS shell using fixed storage_partition name instead of DT
Fix FS shell using fixed 'storage_partition' nodelabel instead of accessing the DT defined partition from the zephyr,fstab,littlefs node partition property. Signed-off-by: Joakim Andersson <[email protected]>
1 parent e1eaa0e commit 0fde156

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

subsys/fs/shell.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
#include <inttypes.h>
1818
#include <limits.h>
1919

20-
#define STORAGE_PARTITION storage_partition
21-
#define STORAGE_PARTITION_ID FIXED_PARTITION_ID(STORAGE_PARTITION)
22-
2320
#ifdef CONFIG_FILE_SYSTEM_SHELL_MOUNT_COMMAND
2421
/* FAT */
2522
#ifdef CONFIG_FAT_FILESYSTEM_ELM
@@ -65,6 +62,15 @@ static struct fs_mount_t littlefs_mnt = {
6562
#else
6663
#include <zephyr/storage/flash_map.h>
6764

65+
#define STORAGE_PARTIION_NODE_ID DT_PHANDLE(DT_INST(0, zephyr_fstab_littlefs), partition)
66+
67+
#if DT_FIXED_PARTITION_EXISTS(STORAGE_PARTIION_NODE_ID)
68+
#define STORAGE_PARTITION_ID DT_FIXED_PARTITION_ID(STORAGE_PARTIION_NODE_ID)
69+
#else
70+
#define STORAGE_PARTITION storage_partition
71+
#define STORAGE_PARTITION_ID FIXED_PARTITION_ID(STORAGE_PARTITION)
72+
#endif
73+
6874
FS_LITTLEFS_DECLARE_DEFAULT_CONFIG(lfs_data);
6975
static struct fs_mount_t littlefs_mnt = {
7076
.type = FS_LITTLEFS,

0 commit comments

Comments
 (0)