[Concept,09/34] vfs: cmd: Move legacy filesystem commands to cmd/fs_legacy.c

Message ID 20260403140523.1998228-10-sjg@u-boot.org
State New
Headers
Series Add a virtual filesystem (VFS) layer to U-Boot |

Commit Message

Simon Glass April 3, 2026, 2:04 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

The legacy filesystem commands (ls, load, save, size, mkdir, rm, ln,
mv, fstype, fstypes) use the interface/dev:part syntax to access
filesystems directly. Move them to cmd/fs_legacy.c and add a new
CONFIG_CMD_FS_LEGACY (default y) to control their compilation.

This frees up cmd/fs.c for new VFS-based implementations that use
absolute paths through the virtual filesystem layer.

CONFIG_CMD_FS_GENERIC selects CONFIG_CMD_FS_LEGACY for backward
compatibility.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 cmd/Kconfig               | 14 +++++++++++++-
 cmd/Makefile              |  2 +-
 cmd/{fs.c => fs_legacy.c} |  0
 3 files changed, 14 insertions(+), 2 deletions(-)
 rename cmd/{fs.c => fs_legacy.c} (100%)
  

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index d56293ea1be..95ccb9fca1a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2973,7 +2973,19 @@  config CMD_FS_GENERIC
 	bool "filesystem commands"
 	help
 	  Enables filesystem commands (e.g. load, ls) that work for multiple
-	  fs types.
+	  fs types. When VFS is available these use absolute paths through
+	  the virtual filesystem. Otherwise the legacy interface/dev:part
+	  commands are used.
+
+config CMD_FS_LEGACY
+	bool "Legacy filesystem commands (ls, load, save, ...)"
+	depends on CMD_FS_GENERIC && !VFS
+	default y
+	help
+	  Enables the legacy filesystem commands that use the
+	  interface/dev:part syntax to access filesystems directly. These
+	  include load, save, ls, size, mkdir, rm, ln, mv, fstype and
+	  fstypes.
 
 config CMD_FS_UUID
 	bool "fsuuid command"
diff --git a/cmd/Makefile b/cmd/Makefile
index 82dcebf92c9..4d1b3eab90c 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -93,7 +93,7 @@  obj-$(CONFIG_CMD_FLASH) += flash.o
 obj-$(CONFIG_CMD_FPGA) += fpga.o
 obj-$(CONFIG_CMD_LUKS) += luks.o
 obj-$(CONFIG_CMD_FPGAD) += fpgad.o
-obj-$(CONFIG_CMD_FS_GENERIC) += fs.o
+obj-$(CONFIG_CMD_FS_LEGACY) += fs_legacy.o
 obj-$(CONFIG_CMD_FUSE) += fuse.o
 obj-$(CONFIG_CMD_FWU_METADATA) += fwu_mdata.o
 obj-$(CONFIG_CMD_GETTIME) += gettime.o
diff --git a/cmd/fs.c b/cmd/fs_legacy.c
similarity index 100%
rename from cmd/fs.c
rename to cmd/fs_legacy.c