fs: delete unused Makefile
Subsystems (4)
PATCH v3 1/3 fs: delete unused Makefile
From: Stephen Warren <[email protected]>
fs/Makefile is unused. The top-level Makefile sets LIBS-y += fs/xxx and hence causes make to directly descend two directory levels into each individual filesystem, and it never descends into fs/ itself.
So, delete this useless file.
---
v3: No change.
v2: No change.
--- fs/Makefile | 42 ------------------------------------------ 1 files changed, 0 insertions(+), 42 deletions(-) delete mode 100644 fs/Makefile
fs/Makefile deleted +0 -42
@@ -1,42 +0,0 @@ -# -# (C) Copyright 2000-2006 -# Wolfgang Denk, DENX Software Engineering, wd at denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# -# - -subdirs-$(CONFIG_CMD_CRAMFS) := cramfs -subdirs-$(CONFIG_CMD_EXT4) += ext4 -ifndef CONFIG_CMD_EXT4 -subdirs-$(CONFIG_CMD_EXT2) += ext4 -endif -subdirs-$(CONFIG_CMD_FAT) += fat -subdirs-$(CONFIG_CMD_FDOS) += fdos -subdirs-$(CONFIG_CMD_JFFS2) += jffs2 -subdirs-$(CONFIG_CMD_REISER) += reiserfs -subdirs-$(CONFIG_YAFFS2) += yaffs2 -subdirs-$(CONFIG_CMD_UBIFS) += ubifs -subdirs-$(CONFIG_CMD_ZFS) += zfs - -SUBDIRS := $(subdirs-y) - -$(obj).depend all: - @for dir in $(SUBDIRS) ; do \ - $(MAKE) -C $$dir $@ ; done
Signature · 1 line
1.7.0.4
PATCH v3 2/3 fs: separate CONFIG_FS_{FAT, EXT4} from CONFIG_CMD_{FAT, EXT*}
From: Stephen Warren <[email protected]>
This makes the FAT and ext4 filesystem implementations build if CONFIG_FS_{FAT,EXT4} are defined, rather than basing the build on whether CONFIG_CMD_{FAT,EXT*} are defined. This will allow the filesystems to be built separately from the filesystem-specific commands that use them. This paves the way for the creation of filesystem-generic commands that used the filesystems, without requiring the filesystem- specific commands.
Minor documentation changes are made for this change.
The new config options are automatically selected by the old config options to retain backwards-compatibility.
---
v3: No change.
v2: New patch.
--- README | 4 +++- doc/README.ext4 | 13 +++++++++++++ fs/ext4/Makefile | 7 ++----- fs/ext4/ext4_common.c | 2 +- fs/ext4/ext4_common.h | 4 ++-- fs/ext4/ext4fs.c | 2 +- fs/fat/Makefile | 4 ++-- include/config_fallbacks.h | 13 +++++++++++++ include/ext4fs.h | 2 +- 9 files changed, 38 insertions(+), 13 deletions(-)
README +3 -1
@@ -801,9 +801,11 @@ The following options need to be configured: CONFIG_CMD_EEPROM * EEPROM read/write support CONFIG_CMD_ELF * bootelf, bootvx CONFIG_CMD_EXPORTENV * export the environment + CONFIG_CMD_EXT2 * ext2 command support + CONFIG_CMD_EXT4 * ext4 command support CONFIG_CMD_SAVEENV saveenv CONFIG_CMD_FDC * Floppy Disk Support - CONFIG_CMD_FAT * FAT partition support + CONFIG_CMD_FAT * FAT command support CONFIG_CMD_FDOS * Dos diskette Support CONFIG_CMD_FLASH flinfo, erase, protect CONFIG_CMD_FPGA FPGA device initialization support
doc/README.ext4 +13 -0
@@ -1,15 +1,28 @@ This patch series adds support for ext4 ls,load and write features in uboot Journaling is supported for write feature. +To enable support for the ext4 (and ext2) filesystem implementation, +#define CONFIG_FS_EXT4 + +If you want write support, +#define CONFIG_EXT4_WRITE + To Enable ext2 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT2 +This automatically defines CONFIG_FS_EXT4 for you. To Enable ext4 ls and load commands, modify the board specific config file with #define CONFIG_CMD_EXT4 +This automatically defines CONFIG_FS_EXT4 for you. To enable ext4 write command, modify the board specific config file with #define CONFIG_CMD_EXT4 #define CONFIG_CMD_EXT4_WRITE +These automatically define CONFIG_FS_EXT4 and CONFIG_EXT4_WRITE for you. + +Also relevant are the generic filesystem commands, +#define CONFIG_CMD_FS_GENERIC +This does not automatically enable EXT4 support for you. Steps to test:
fs/ext4/Makefile +2 -5
@@ -30,11 +30,8 @@ include $(TOPDIR)/config.mk LIB = $(obj)libext4fs.o AOBJS = -COBJS-$(CONFIG_CMD_EXT4) := ext4fs.o ext4_common.o dev.o -ifndef CONFIG_CMD_EXT4 -COBJS-$(CONFIG_CMD_EXT2) := ext4fs.o ext4_common.o dev.o -endif -COBJS-$(CONFIG_CMD_EXT4_WRITE) += ext4_journal.o crc16.o +COBJS-$(CONFIG_FS_EXT4) := ext4fs.o ext4_common.o dev.o +COBJS-$(CONFIG_EXT4_WRITE) += ext4_journal.o crc16.o SRCS := $(AOBJS:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(AOBJS) $(COBJS-y))
fs/ext4/ext4_common.c +1 -1
@@ -56,7 +56,7 @@ int ext4fs_indir3_blkno = -1;struct ext2_inode *g_parent_inode;static int symlinknest; -#if defined(CONFIG_CMD_EXT4_WRITE ) +#if defined(CONFIG_EXT4_WRITE )uint32_t ext4fs_div_roundup (uint32_t size,uint32_t n) {uint32_t res = size / n;
fs/ext4/ext4_common.h +2 -2
@@ -37,7 +37,7 @@#include <ext4fs.h> #include <malloc.h> #include <asm/errno.h> -#if defined(CONFIG_CMD_EXT4_WRITE ) +#if defined(CONFIG_EXT4_WRITE )#include "ext4_journal.h" #include "crc16.h" #endif
@@ -71,7 +71,7 @@ int ext4fs_find_file(const char *path, struct ext2fs_node *rootnode,int ext4fs_iterate_dir (struct ext2fs_node *dir,char *name,struct ext2fs_node **fnode,int *ftype); -#if defined(CONFIG_CMD_EXT4_WRITE ) +#if defined(CONFIG_EXT4_WRITE )uint32_t ext4fs_div_roundup (uint32_t size,uint32_t n);int ext4fs_checksum_update (unsigned int i);int ext4fs_get_parent_inode_num (const char *dirname,char *dname,int flags);
fs/ext4/ext4fs.c +1 -1
@@ -196,7 +196,7 @@ int ext4fs_read(char *buf, unsigned len)return ext4fs_read_file (ext4fs_file,0 , len, buf); } -#if defined(CONFIG_CMD_EXT4_WRITE ) +#if defined(CONFIG_EXT4_WRITE )static void ext4fs_update (void ) {short i;
fs/fat/Makefile +2 -2
@@ -24,11 +24,11 @@ include $(TOPDIR)/config.mk LIB = $(obj)libfat.o AOBJS = -COBJS-$(CONFIG_CMD_FAT) := fat.o +COBJS-$(CONFIG_FS_FAT) := fat.o COBJS-$(CONFIG_FAT_WRITE):= fat_write.o ifndef CONFIG_SPL_BUILD -COBJS-$(CONFIG_CMD_FAT) += file.o +COBJS-$(CONFIG_FS_FAT) += file.o endif SRCS := $(AOBJS:.o=.S) $(COBJS-y:.o=.c)
include/config_fallbacks.h +13 -0
@@ -13,4 +13,17 @@#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }#endif +#if defined(CONFIG_CMD_FAT ) && !defined(CONFIG_FS_FAT ) +#define CONFIG_FS_FAT +#endif + +#if (defined(CONFIG_CMD_EXT4 ) || defined(CONFIG_CMD_EXT2 )) && \ + !defined(CONFIG_FS_EXT4 ) +#define CONFIG_FS_EXT4 +#endif + +#if defined(CONFIG_CMD_EXT4_WRITE ) && !defined(CONFIG_EXT4_WRITE ) +#define CONFIG_EXT4_WRITE +#endif +#endif /* __CONFIG_FALLBACKS_H */
include/ext4fs.h +1 -1
@@ -116,7 +116,7 @@ struct ext_filesystem {extern struct ext2_data *ext4fs_root;extern struct ext2fs_node *ext4fs_file; -#if defined(CONFIG_CMD_EXT4_WRITE ) +#if defined(CONFIG_EXT4_WRITE )extern struct ext2_inode *g_parent_inode;extern int gd_index;extern int gindex;
Signature · 1 line
1.7.0.4
PATCH v3 3/3 fs: add filesystem switch libary, implement ls and fsload commands
In reply to Stephen WarrenFrom: Stephen Warren <[email protected]>
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.
---
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(-) delete mode 100644 common/cmd_ext_common.c create mode 100644 common/cmd_fs.c create mode 100644 fs/Makefile create mode 100644 fs/fs.c create mode 100644 include/fs.h
Makefile +2 -1
@@ -260,7 +260,8 @@ LIBS-y += drivers/net/npe/libnpe.o endif LIBS-$(CONFIG_OF_EMBED) += dts/libdts.o LIBS-y += arch/$(ARCH)/lib/lib$(ARCH).o -LIBS-y += fs/cramfs/libcramfs.o \ +LIBS-y += fs/libfs.o \ + fs/cramfs/libcramfs.o \ fs/ext4/libext4fs.o \ fs/fat/libfat.o \ fs/fdos/libfdos.o \
common/Makefile +1 -5
@@ -88,11 +88,6 @@ COBJS-$(CONFIG_CMD_ELF) += cmd_elf.o COBJS-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o COBJS-$(CONFIG_CMD_EXT4) += cmd_ext4.o COBJS-$(CONFIG_CMD_EXT2) += cmd_ext2.o -ifdef CONFIG_CMD_EXT4 -COBJS-y += cmd_ext_common.o -else -COBJS-$(CONFIG_CMD_EXT2) += cmd_ext_common.o -endif COBJS-$(CONFIG_CMD_FAT) += cmd_fat.o COBJS-$(CONFIG_CMD_FDC)$(CONFIG_CMD_FDOS) += cmd_fdc.o COBJS-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
@@ -102,6 +97,7 @@ COBJS-$(CONFIG_CMD_FLASH) += cmd_flash.o ifdef CONFIG_FPGA COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o endif +COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
common/cmd_ext2.c +3 -10
@@ -37,15 +37,11 @@/* * Ext2fs support */ -#include <common.h> -#include <ext_common.h> +#include <fs.h> int do_ext2ls (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -if (do_ext_ls (cmdtp, flag, argc, argv)) -return -1 ; - -return 0 ; +return do_ls (cmdtp, flag, argc, argv,FS_EXT ); }/******************************************************************************
@@ -53,10 +49,7 @@ int do_ext2ls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])*/ int do_ext2load (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -if (do_ext_load (cmdtp, flag, argc, argv)) -return -1 ; - -return 0 ; +return do_fsload (cmdtp, flag, argc, argv,FS_EXT ); } U_BOOT_CMD(
common/cmd_ext4.c +3 -9
@@ -47,10 +47,10 @@#include <image.h> #include <linux/ctype.h> #include <asm/byteorder.h> -#include <ext_common.h> #include <ext4fs.h> #include <linux/stat.h> #include <malloc.h> +#include <fs.h> #if defined(CONFIG_CMD_USB ) && defined(CONFIG_USB_STORAGE )#include <usb.h>
@@ -59,18 +59,12 @@int do_ext4_load (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -if (do_ext_load (cmdtp, flag, argc, argv)) -return -1 ; - -return 0 ; +return do_fsload (cmdtp, flag, argc, argv,FS_EXT ); }int do_ext4_ls (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -if (do_ext_ls (cmdtp, flag, argc, argv)) -return -1 ; - -return 0 ; +return do_ls (cmdtp, flag, argc, argv,FS_EXT ); }#if defined(CONFIG_CMD_EXT4_WRITE )
common/cmd_ext_common.c deleted +0 -197
197 lines not on this page · raw message
common/cmd_fat.c +3 -73
91 lines not on this page · raw message
common/cmd_fs.c new file +51 -0
51 lines not on this page · raw message
fs/Makefile new file +47 -0
47 lines not on this page · raw message
fs/fs.c new file +298 -0
298 lines not on this page · raw message
include/ext_common.h +0 -3
@@ -195,7 +195,4 @@ int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,int do_ext4_ls (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]);int do_ext4_write (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]); -int do_ext_load (cmd_tbl_t *cmdtp,int flag,int argc, -char *const argv[]); -int do_ext_ls (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]);#endif
include/fs.h new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v3 3/3 fs: add filesystem switch libary, implement ls and fsload commands
Quoted 29 lines · Stephen Warren
From: Stephen Warren <[email protected]>
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 <[email protected]>---
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 intofs.c.
* Removedcmd_ext_common.c.
* s/partition/filesystem/ in patch subject.
v2:
* Buildcmd_fs.cwhenCONFIG_CMD_FS_GENERICnot always.
* Use new CONFIG_FS_{FAT,EXT4} rather than CONFIG_CMD_{FAT,EXT2}.
* Implementedfs_close()and call it from the tail offs_ls()andfs_read(). This ensures that any other usage of e.g. the ext4 library between fs_*() calls, then the two usages won't interfere.
* Re-organizedfs.cto reduce the number of ifdef blocks.
* Added argc checking todo_ls().
Quoted 13 lines
--- 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...
Review
Quoted 7 lines
(quoted diff) +6
-0+#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