diff options
author | Simon Kagstrom <simon.kagstrom@netinsight.net> | 2009-07-07 16:01:02 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2009-07-09 13:04:25 +0200 |
commit | 2896b5851f0430bf16529376a4193630e966c788 (patch) | |
tree | 26a160bf07a1188aa838a2b668a62b50684b0506 /common/cmd_ubifs.c | |
parent | 25c8f4005979ab2d190713ba341d96a5fa905cdb (diff) | |
download | u-boot-imx-2896b5851f0430bf16529376a4193630e966c788.zip u-boot-imx-2896b5851f0430bf16529376a4193630e966c788.tar.gz u-boot-imx-2896b5851f0430bf16529376a4193630e966c788.tar.bz2 |
Command improvements for ubifs
Check that an argument is passed to ubifsmount and that addresses and
sizes are actually numbers for ubifsload. Also improve the instructions
a bit.
Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common/cmd_ubifs.c')
-rw-r--r-- | common/cmd_ubifs.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index d9f60d5..ed0e9db 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -47,6 +47,10 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) char *vol_name; int ret; + if (argc != 2) { + cmd_usage(cmdtp); + return 1; + } vol_name = argv[1]; debug("Using volume %s\n", vol_name); @@ -88,6 +92,7 @@ int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char *filename; + char *endp; int ret; u32 addr; u32 size = 0; @@ -98,15 +103,25 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } if (argc < 3) { - printf("Usage:\n%s\n", cmdtp->usage); + cmd_usage(cmdtp); return -1; } - addr = simple_strtoul(argv[1], NULL, 16); + addr = simple_strtoul(argv[1], &endp, 16); + if (endp == argv[1]) { + cmd_usage(cmdtp); + return 1; + } + filename = argv[2]; - if (argc == 4) - size = simple_strtoul(argv[3], NULL, 16); + if (argc == 4) { + size = simple_strtoul(argv[3], &endp, 16); + if (endp == argv[3]) { + cmd_usage(cmdtp); + return 1; + } + } debug("Loading file '%s' to address 0x%08x (size %d)\n", filename, addr, size); ret = ubifs_load(filename, addr, size); @@ -119,7 +134,8 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( ubifsmount, 2, 0, do_ubifs_mount, "mount UBIFS volume", - "" + "<volume-name>\n" + " - mount 'volume-name' volume" ); U_BOOT_CMD(ubifsls, 2, 0, do_ubifs_ls, |