X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=cmd%2Fubifs.c;h=e4000b7ad19dd466940fc7394bc5c45f8f80e54c;hb=b7cd95627baac05b7023b014c802be309be636a0;hp=5e9d357cd7d6f0a3d03d7e6634b7a1ad41060dfa;hpb=cd85bec36d0e0d16fedb00e0c434ed070a9c6b37;p=oweals%2Fu-boot.git diff --git a/cmd/ubifs.c b/cmd/ubifs.c index 5e9d357cd7..e4000b7ad1 100644 --- a/cmd/ubifs.c +++ b/cmd/ubifs.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2008 * Stefan Roese, DENX Software Engineering, sr@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ @@ -20,16 +19,10 @@ static int ubifs_initialized; static int ubifs_mounted; -static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, - char * const argv[]) +int cmd_ubifs_mount(char *vol_name) { - char *vol_name; int ret; - if (argc != 2) - return CMD_RET_USAGE; - - vol_name = argv[1]; debug("Using volume %s\n", vol_name); if (ubifs_initialized == 0) { @@ -43,7 +36,19 @@ static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, ubifs_mounted = 1; - return 0; + return ret; +} +static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + char *vol_name; + + if (argc != 2) + return CMD_RET_USAGE; + + vol_name = argv[1]; + + return cmd_ubifs_mount(vol_name); } int ubifs_is_mounted(void) @@ -51,11 +56,18 @@ int ubifs_is_mounted(void) return ubifs_mounted; } -void cmd_ubifs_umount(void) +int cmd_ubifs_umount(void) { + if (ubifs_initialized == 0) { + printf("No UBIFS volume mounted!\n"); + return -1; + } + uboot_ubifs_umount(); ubifs_mounted = 0; ubifs_initialized = 0; + + return 0; } static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc, @@ -64,14 +76,7 @@ static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc, if (argc != 1) return CMD_RET_USAGE; - if (ubifs_initialized == 0) { - printf("No UBIFS volume mounted!\n"); - return -1; - } - - cmd_ubifs_umount(); - - return 0; + return cmd_ubifs_umount(); } static int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc,