On Mon 2014-11-03 18:49:58, Suriyan Ramasami wrote:
> Change the interface for the generic FS functions to take in an extra
> parameter of type "loff_t *" to return the size. The return values of
> these funtions now serve as an indicator of error conditions alone.
> 
> Signed-off-by: Suriyan Ramasami <suriya...@gmail.com>
> ---
> 
> Changes in v6:
> * Simon - Split this into a separate patch
> 
> Changes in v5:
> * Simon - update fs.h with comments for fs_read/fs_write/fs_size
> 
>  common/cmd_fs.c | 17 +++++++++++++
>  fs/fs.c         | 77 
> ++++++++++++++++++++++++++++++++++-----------------------
>  include/fs.h    | 41 ++++++++++++++++++------------
>  3 files changed, 88 insertions(+), 47 deletions(-)
> 
> diff --git a/common/cmd_fs.c b/common/cmd_fs.c
> index 6754340..f70cb8a 100644
> --- a/common/cmd_fs.c
> +++ b/common/cmd_fs.c
> @@ -51,6 +51,23 @@ U_BOOT_CMD(
>       "      If 'pos' is 0 or omitted, the file is read from the start."
>  )
>  
> +static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
> +                             char * const argv[])
> +{
> +     return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
> +}
> +
> +U_BOOT_CMD(
> +     save,   7,      0,      do_save_wrapper,
> +     "save file to a filesystem",
> +     "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"

That's not correct, AFAICT.

int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
                int fstype)
{
        unsigned long addr;
        const char *filename;
        unsigned long bytes;
        unsigned long pos;
        int len;
        unsigned long time;

        if (argc < 6 || argc > 7)
                return CMD_RET_USAGE;

More arguments are mandatory then you describe here.

> +     "    - Save binary file 'filename' to partition 'part' on device\n"
> +     "      type 'interface' instance 'dev' from addr 'addr' in memory.\n"
> +     "      'bytes' gives the size to save in bytes and is mandatory.\n"
> +     "      'pos' gives the file byte position to start writing to.\n"
> +     "      If 'pos' is 0 or omitted, the file is written from the start."

Plus maybe note if it can extend existing files and create files if
they don't exit would be nice here?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to