Message ID | 20191211174637.7.I54725907dac44a8fc71676cf9ae42422470b30ec@changeid |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | common: Further reduce size of common.h even more | expand |
On 12/12/19 1:47 AM, Simon Glass wrote: > These are filesystem functions and belong in the filesystem header file. > Move them. I am not very fond of having any file system dependencies outside of disk/ and part/. Do we need the functions do_ext2load() and do_fat_fsload() at all? What is the benefit of the file system parameter in the sysboot command? Why have a restriction to ext2 in board/inversepath/usbarmory/usbarmory.c? Can't we simply make the ext2load and fatload commands an alias for load? Best regards Heinrich > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > board/inversepath/usbarmory/usbarmory.c | 1 + > cmd/fat.c | 2 +- > cmd/pxe.c | 1 + > include/common.h | 6 ------ > include/fs.h | 22 ++++++++++++++++++++++ > 5 files changed, 25 insertions(+), 7 deletions(-) > > diff --git a/board/inversepath/usbarmory/usbarmory.c b/board/inversepath/usbarmory/usbarmory.c > index 19510184d8..e9eea40e45 100644 > --- a/board/inversepath/usbarmory/usbarmory.c > +++ b/board/inversepath/usbarmory/usbarmory.c > @@ -9,6 +9,7 @@ > > #include <common.h> > #include <command.h> > +#include <fs.h> > #include <asm/io.h> > #include <asm/arch/imx-regs.h> > #include <asm/arch/sys_proto.h> > diff --git a/cmd/fat.c b/cmd/fat.c > index 4b9a7eaab0..50df127f6d 100644 > --- a/cmd/fat.c > +++ b/cmd/fat.c > @@ -31,7 +31,7 @@ U_BOOT_CMD( > " and determine its size." > ); > > -int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > +int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > { > return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT); > } > diff --git a/cmd/pxe.c b/cmd/pxe.c > index 194a366aa1..bce6728875 100644 > --- a/cmd/pxe.c > +++ b/cmd/pxe.c > @@ -6,6 +6,7 @@ > > #include <common.h> > #include <command.h> > +#include <fs.h> > #include <net.h> > > #include "pxe_utils.h" > diff --git a/include/common.h b/include/common.h > index dbd7845a63..e5de74af33 100644 > --- a/include/common.h > +++ b/include/common.h > @@ -81,12 +81,6 @@ extern ulong load_addr; /* Default Load Address */ > extern ulong save_addr; /* Default Save Address */ > extern ulong save_size; /* Default Save Size */ > > -/* common/cmd_fat.c */ > -int do_fat_fsload(cmd_tbl_t *, int, int, char * const []); > - > -/* common/cmd_ext2.c */ > -int do_ext2load(cmd_tbl_t *, int, int, char * const []); > - > /* common/exports.c */ > void jumptable_init(void); > > diff --git a/include/fs.h b/include/fs.h > index 742a535b5f..37e35c2120 100644 > --- a/include/fs.h > +++ b/include/fs.h > @@ -14,6 +14,28 @@ > #define FS_TYPE_UBIFS 4 > #define FS_TYPE_BTRFS 5 > > +/** > + * do_fat_fsload - Run the fatload command > + * > + * @cmdtp: Command information for fatload > + * @flag: Command flags (CMD_FLAG_...) > + * @argc: Number of arguments > + * @argv: List of arguments > + * @return result (see enum command_ret_t) > + */ > +int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); > + > +/** > + * do_ext2load - Run the ext2load command > + * > + * @cmdtp: Command information for ext2load > + * @flag: Command flags (CMD_FLAG_...) > + * @argc: Number of arguments > + * @argv: List of arguments > + * @return result (see enum command_ret_t) > + */ > +int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); > + > /* > * Tell the fs layer which block device an partition to use for future > * commands. This also internally identifies the filesystem that is present >
On Thu, Dec 12, 2019 at 09:31:08AM +0100, Heinrich Schuchardt wrote: > On 12/12/19 1:47 AM, Simon Glass wrote: > > These are filesystem functions and belong in the filesystem header file. > > Move them. > > I am not very fond of having any file system dependencies outside of > disk/ and part/. > > Do we need the functions do_ext2load() and do_fat_fsload() at all? > > What is the benefit of the file system parameter in the sysboot command? A patch to make CMD_SYSBOOT depend on CMD_FS_GENERIC and see if everyone is already doing that would be good. Implementation-wise it's going to be fat/ext2/tftp. > Why have a restriction to ext2 in board/inversepath/usbarmory/usbarmory.c? Intended usage only maybe? I'll let Andrej chime in here.
diff --git a/board/inversepath/usbarmory/usbarmory.c b/board/inversepath/usbarmory/usbarmory.c index 19510184d8..e9eea40e45 100644 --- a/board/inversepath/usbarmory/usbarmory.c +++ b/board/inversepath/usbarmory/usbarmory.c @@ -9,6 +9,7 @@ #include <common.h> #include <command.h> +#include <fs.h> #include <asm/io.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> diff --git a/cmd/fat.c b/cmd/fat.c index 4b9a7eaab0..50df127f6d 100644 --- a/cmd/fat.c +++ b/cmd/fat.c @@ -31,7 +31,7 @@ U_BOOT_CMD( " and determine its size." ); -int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT); } diff --git a/cmd/pxe.c b/cmd/pxe.c index 194a366aa1..bce6728875 100644 --- a/cmd/pxe.c +++ b/cmd/pxe.c @@ -6,6 +6,7 @@ #include <common.h> #include <command.h> +#include <fs.h> #include <net.h> #include "pxe_utils.h" diff --git a/include/common.h b/include/common.h index dbd7845a63..e5de74af33 100644 --- a/include/common.h +++ b/include/common.h @@ -81,12 +81,6 @@ extern ulong load_addr; /* Default Load Address */ extern ulong save_addr; /* Default Save Address */ extern ulong save_size; /* Default Save Size */ -/* common/cmd_fat.c */ -int do_fat_fsload(cmd_tbl_t *, int, int, char * const []); - -/* common/cmd_ext2.c */ -int do_ext2load(cmd_tbl_t *, int, int, char * const []); - /* common/exports.c */ void jumptable_init(void); diff --git a/include/fs.h b/include/fs.h index 742a535b5f..37e35c2120 100644 --- a/include/fs.h +++ b/include/fs.h @@ -14,6 +14,28 @@ #define FS_TYPE_UBIFS 4 #define FS_TYPE_BTRFS 5 +/** + * do_fat_fsload - Run the fatload command + * + * @cmdtp: Command information for fatload + * @flag: Command flags (CMD_FLAG_...) + * @argc: Number of arguments + * @argv: List of arguments + * @return result (see enum command_ret_t) + */ +int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); + +/** + * do_ext2load - Run the ext2load command + * + * @cmdtp: Command information for ext2load + * @flag: Command flags (CMD_FLAG_...) + * @argc: Number of arguments + * @argv: List of arguments + * @return result (see enum command_ret_t) + */ +int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); + /* * Tell the fs layer which block device an partition to use for future * commands. This also internally identifies the filesystem that is present
These are filesystem functions and belong in the filesystem header file. Move them. Signed-off-by: Simon Glass <sjg@chromium.org> --- board/inversepath/usbarmory/usbarmory.c | 1 + cmd/fat.c | 2 +- cmd/pxe.c | 1 + include/common.h | 6 ------ include/fs.h | 22 ++++++++++++++++++++++ 5 files changed, 25 insertions(+), 7 deletions(-)