From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rob Herring Date: Sat, 20 Oct 2012 08:50:53 -0500 Subject: [U-Boot] [PATCH V3 3/3] fs: add filesystem switch libary, implement ls and fsload commands In-Reply-To: <1350684676-6110-3-git-send-email-swarren@wwwdotorg.org> References: <1350684676-6110-1-git-send-email-swarren@wwwdotorg.org> <1350684676-6110-3-git-send-email-swarren@wwwdotorg.org> Message-ID: <5082AC3D.2090108@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/19/2012 05:11 PM, Stephen Warren wrote: > From: Stephen Warren > > 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 > --- > 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