[U-Boot] [PATCH V3 3/3] fs: add filesystem switch libary, implement ls and fsload commands
Rob Herring
robherring2 at gmail.com
Sat Oct 20 15:50:53 CEST 2012
On 10/19/2012 05:11 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> Implement "ls" and "fsload" commands that act like {fat,ext2}{ls,load},
> and transparently handle either file-system. This scheme could easily be
> extended to other filesystem types; I only didn't do it for zfs because
> I don't have any filesystems of that type to test with.
>
> Replace the implementation of {fat,ext[24]}{ls,load} with this new code
> too.
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
> v3:
> * Updated the implementation of the new commands to be suitable for use
> as the body of {fat,ext[24]}{ls,load} too.
> * Enhanced the implementation to make more fsload parameters optional
> (load address, filename); they can now come from environment variables
> like ext2load supported.
> * Moved implementation into fs.c.
> * Removed cmd_ext_common.c.
> * s/partition/filesystem/ in patch subject.
> v2:
> * Build cmd_fs.c when CONFIG_CMD_FS_GENERIC not always.
> * Use new CONFIG_FS_{FAT,EXT4} rather than CONFIG_CMD_{FAT,EXT2}.
> * Implemented fs_close() and call it from the tail of fs_ls() and fs_read().
> This ensures that any other usage of e.g. the ext4 library between fs_*()
> calls, then the two usages won't interfere.
> * Re-organized fs.c to reduce the number of ifdef blocks.
> * Added argc checking to do_ls().
> ---
> Makefile | 3 +-
> common/Makefile | 6 +-
> common/cmd_ext2.c | 13 +--
> common/cmd_ext4.c | 12 +--
> common/cmd_ext_common.c | 197 -------------------------------
> common/cmd_fat.c | 76 +------------
> common/cmd_fs.c | 51 ++++++++
> fs/Makefile | 47 ++++++++
> fs/fs.c | 298 +++++++++++++++++++++++++++++++++++++++++++++++
> include/ext_common.h | 3 -
> include/fs.h | 65 ++++++++++
> 11 files changed, 473 insertions(+), 298 deletions(-)
Now, I like the diffstat...
> +#define FS_TYPE_INVALID 0
> +#define FS_TYPE_FAT 1
> +#define FS_TYPE_EXT 2
> +#define FS_FAT (1 << 0)
> +#define FS_EXT (1 << 1)
> +#define FS_ANY 0xffffffff
Seems like these should be combined. I would go with the first one. I
think either you specify a single fs or you probe it. Plus we might want
to support more than 32 filesystems someday. ;)
Rob
More information about the U-Boot
mailing list