diff options
author | Stefan Roese <sr@denx.de> | 2010-10-28 14:09:22 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2010-12-03 16:32:09 +0100 |
commit | cb9c09d4871015be5710c7bae29b06218ddc3509 (patch) | |
tree | a29fdf9973a9e0da2b0dc09c256335de66aab447 /common/cmd_ubifs.c | |
parent | 49733aa0b9d29803384ad4bce74985f4bbe7e9aa (diff) | |
download | u-boot-cb9c09d4871015be5710c7bae29b06218ddc3509.zip u-boot-cb9c09d4871015be5710c7bae29b06218ddc3509.tar.gz u-boot-cb9c09d4871015be5710c7bae29b06218ddc3509.tar.bz2 |
UBIFS: Add ubifsumount command to unmount an active volume
This new ubifsumount command allows the user to unmount a previously
mounted UBIFS volume.
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common/cmd_ubifs.c')
-rw-r--r-- | common/cmd_ubifs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index a0ec184..30b23d3 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -33,12 +33,17 @@ #include <config.h> #include <command.h> +#include "../fs/ubifs/ubifs.h" + static int ubifs_initialized; static int ubifs_mounted; +extern struct super_block *ubifs_sb; + /* Prototypes */ int ubifs_init(void); int ubifs_mount(char *vol_name); +void ubifs_umount(struct ubifs_info *c); int ubifs_ls(char *dir_name); int ubifs_load(char *filename, u32 addr, u32 size); @@ -67,6 +72,26 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 0; } +int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + if (argc != 1) + return cmd_usage(cmdtp); + + if (ubifs_initialized == 0) { + printf("No UBIFS volume mounted!\n"); + return -1; + } + + if (ubifs_sb) + ubifs_umount(ubifs_sb->s_fs_info); + + ubifs_sb = NULL; + ubifs_mounted = 0; + ubifs_initialized = 0; + + return 0; +} + int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *filename = "/"; @@ -132,6 +157,12 @@ U_BOOT_CMD( ); U_BOOT_CMD( + ubifsumount, 1, 0, do_ubifs_umount, + "unmount UBIFS volume", + " - unmount current volume" +); + +U_BOOT_CMD( ubifsls, 2, 0, do_ubifs_ls, "list files in a directory", "[directory]\n" |