public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume
@ 2010-10-28 12:09 Stefan Roese
  2010-10-29 14:00 ` Ben Gardiner
  2010-12-03 15:51 ` Stefan Roese
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Roese @ 2010-10-28 12:09 UTC (permalink / raw)
  To: u-boot

This new ubifsumount command allows the user to unmount a previously
mounted UBIFS volume.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 common/cmd_ubifs.c |   31 +++++++++++++++++++++++++++++++
 fs/ubifs/super.c   |    2 +-
 2 files changed, 32 insertions(+), 1 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"
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 39e3efe..63b2164 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -824,7 +824,7 @@ out_free:
  * through mounting (error path cleanup function). So it has to make sure the
  * resource was actually allocated before freeing it.
  */
-static void ubifs_umount(struct ubifs_info *c)
+void ubifs_umount(struct ubifs_info *c)
 {
 	dbg_gen("un-mounting UBI device %d, volume %d", c->vi.ubi_num,
 		c->vi.vol_id);
-- 
1.7.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume
  2010-10-28 12:09 [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume Stefan Roese
@ 2010-10-29 14:00 ` Ben Gardiner
  2010-12-03 15:51 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Gardiner @ 2010-10-29 14:00 UTC (permalink / raw)
  To: u-boot

On Thu, Oct 28, 2010 at 8:09 AM, Stefan Roese <sr@denx.de> wrote:
> This new ubifsumount command allows the user to unmount a previously
> mounted UBIFS volume.
>
> Signed-off-by: Stefan Roese <sr@denx.de>

Applies to 908614f20f7f0f5df736eed21b88e81ebbf14e86 of
git://git.denx.de/u-boot.git.

Two checkpatch warnings:

WARNING: externs should be avoided in .c files
#92: FILE: common/cmd_ubifs.c:41:
+extern struct super_block *ubifs_sb;

WARNING: externs should be avoided in .c files
#97: FILE: common/cmd_ubifs.c:46:
+void ubifs_umount(struct ubifs_info *c);

total: 0 errors, 2 warnings, 63 lines checked

Tested on da850evm with NAND, env.oob enabled. I was able to
ubifumount after a ubifsload.

Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume
  2010-10-28 12:09 [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume Stefan Roese
  2010-10-29 14:00 ` Ben Gardiner
@ 2010-12-03 15:51 ` Stefan Roese
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2010-12-03 15:51 UTC (permalink / raw)
  To: u-boot

On Thursday 28 October 2010 14:09:22 Stefan Roese wrote:
> This new ubifsumount command allows the user to unmount a previously
> mounted UBIFS volume.

Applied to u-boot-ubi/master. Thanks.

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-03 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-28 12:09 [U-Boot] [PATCH 2/4] UBIFS: Add ubifsumount command to unmount an active volume Stefan Roese
2010-10-29 14:00 ` Ben Gardiner
2010-12-03 15:51 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox