
From: Simon Glass <sjg@chromium.org> U-Boot's filesystems work reasonably well but could be improved: - There is no equivalent of Linux's VFS, meaning that the device type must be provided with filesystem commands like 'ls' and 'load' - There is no caching, nor really anything to hang caching on to, so each access causes the filesystem to be remounted - There is no real 'driver model' access to filesystems, in the sense of opening a file, reading it and then later closing it - It is quite hard to support non-block filesystems, since many functions pass around a struct blk_desc for want of a better structure. As a first step towards improving things, this series provides a simple filesystem uclass, which can be implemented to provide access to filesystems via driver model. Only one filesystem is currently supported: sandbox's hostfs The existing filesystem layer is renamed to 'legacy', to indicate that it is on the way out. New filesystems should try to build on this new series. The rename is only partial, since there is no attempt here to replace the existing filesystem commands. Basic versions of a directory and file are also added. The directory uclass only supports listing directories. The file uclass only supports reading files. There is a small test. From this small start, we can perhaps build on more features. Simon Glass (19): blk: Use hex indices for the device name dm: Rename dev_get_child_count() to dev_read_child_count() sandbox: Update os_open() to return an error code fs: Rename fs.h to fs_legacy.h fs: Rename fs.c to fs_legacy.c fs: Provide a Kconfig option for legacy-filesystem support fs: Provide an SPL Kconfig for legacy-filesystem support fs: Create a common header for legacy and new fs: Create a header file for filesystem-related commands fs: Rename fs_read() to fs_legacy_read() fs: Provide information about non-block filesystems bootstd: Use an enum for hunter numbers fs: Add support for a filesystem fs: Add simple sandbox test fs: Add support for a directory fs: Add a sandbox test for the directory uclass fs: Add a header file for I/O iteration fs: Add support for a file fs: Add a sandbox test for the file uclass MAINTAINERS | 14 + arch/arm/mach-k3/common.c | 2 +- arch/sandbox/cpu/os.c | 33 +- arch/sandbox/dts/test.dts | 13 + board/gdsys/a38x/hre.c | 2 +- board/inversepath/usbarmory/usbarmory.c | 2 +- boot/bootdev-uclass.c | 2 +- boot/bootmeth-uclass.c | 4 +- boot/bootmeth_efi.c | 2 +- boot/bootmeth_extlinux.c | 2 +- boot/bootmeth_pxe.c | 2 +- boot/bootmeth_script.c | 2 +- cmd/addr_find.c | 2 +- cmd/btrfs.c | 2 +- cmd/cat.c | 2 +- cmd/cedit.c | 2 +- cmd/erofs.c | 2 +- cmd/ext2.c | 2 +- cmd/ext4.c | 2 +- cmd/fat.c | 2 +- cmd/fpga.c | 2 +- cmd/fs.c | 2 +- cmd/fs_uuid.c | 3 +- cmd/host.c | 2 +- cmd/mvebu/bubt.c | 8 +- cmd/pstore.c | 2 +- cmd/pxe.c | 2 +- cmd/sqfs.c | 2 +- cmd/sysboot.c | 4 +- cmd/test.c | 2 +- cmd/xxd.c | 4 +- common/board_f.c | 2 +- common/spl/spl_blk_fs.c | 6 +- common/splash_source.c | 4 +- disk/part.c | 3 +- doc/develop/bootstd/overview.rst | 4 +- drivers/adc/stm32-adc.c | 2 +- drivers/block/blk-uclass.c | 2 +- drivers/block/host_dev.c | 4 +- drivers/bootcount/bootcount_fs.c | 7 +- drivers/core/read.c | 2 +- drivers/dfu/dfu_mmc.c | 3 +- drivers/dfu/dfu_scsi.c | 3 +- drivers/fastboot/fb_getvar.c | 2 +- drivers/fpga/zynqpl.c | 10 +- drivers/misc/Kconfig | 2 + drivers/misc/fs_loader.c | 7 +- drivers/mtd/spi/sandbox.c | 2 +- drivers/net/phy/aquantia.c | 6 +- drivers/phy/phy-mtk-tphy.c | 2 +- drivers/remoteproc/ipu_rproc.c | 2 +- drivers/scsi/sandbox_scsi.c | 2 +- drivers/usb/emul/sandbox_flash.c | 2 +- drivers/virtio/virtio-uclass.c | 2 +- drivers/virtio/virtio_sandbox.c | 3 + fs/Kconfig | 40 +++ fs/Makefile | 8 +- fs/dir-uclass.c | 121 +++++++ fs/erofs/erofs_fs.h | 2 +- fs/exfat/io.c | 2 +- fs/fat/fat.c | 2 +- fs/file-uclass.c | 103 ++++++ fs/fs-uclass.c | 122 +++++++ fs/{fs.c => fs_legacy.c} | 12 +- fs/sandbox/hostfs_bootdev.c | 2 +- fs/sandbox/sandboxfs.c | 271 +++++++++++++++- fs/semihostingfs.c | 2 +- fs/squashfs/sqfs.c | 2 +- fs/squashfs/sqfs_filesystem.h | 2 +- include/dir.h | 141 +++++++++ include/dm/read.h | 6 +- include/dm/uclass-id.h | 3 + include/dt-bindings/virtio.h | 1 + include/erofs.h | 3 + include/ext4fs.h | 2 +- include/fat.h | 2 +- include/file.h | 86 +++++ include/fs.h | 404 ++++-------------------- include/fs_cmd.h | 83 +++++ include/fs_common.h | 76 +++++ include/fs_legacy.h | 244 ++++++++++++++ include/iovec.h | 85 +++++ include/os.h | 12 +- include/part.h | 2 + include/squashfs.h | 3 + lib/efi_loader/efi_capsule.c | 2 +- lib/efi_loader/efi_disk.c | 2 +- lib/efi_loader/efi_file.c | 6 +- lib/efi_loader/efi_helper.c | 2 +- lib/efi_loader/efi_load_initrd.c | 2 +- lib/efi_loader/efi_var_file.c | 6 +- test/boot/bootdev.c | 43 +-- test/boot/bootflow.c | 4 +- test/boot/bootstd_common.h | 11 +- test/dm/Makefile | 1 + test/dm/fs.c | 106 +++++++ test/dm/host.c | 2 +- test/dm/rkmtd.c | 2 +- test/image/spl_load_fs.c | 7 +- 99 files changed, 1781 insertions(+), 472 deletions(-) create mode 100644 fs/dir-uclass.c create mode 100644 fs/file-uclass.c create mode 100644 fs/fs-uclass.c rename fs/{fs.c => fs_legacy.c} (98%) create mode 100644 include/dir.h create mode 100644 include/file.h create mode 100644 include/fs_cmd.h create mode 100644 include/fs_common.h create mode 100644 include/fs_legacy.h create mode 100644 include/iovec.h create mode 100644 test/dm/fs.c -- 2.43.0 base-commit: 1c71a3f024de2249cf8264dc0b8fb746fd619cea branch: qemc