Skip to contentSkip to conversation

cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

PATCH New tien.fong.chee at intel.com 3 participants 3 messages Jul 6, 2018 – Sep 29, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v4 2/6 cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

From: Tien Fong Chee <[email protected]>

cmd_ubifs_mount() function would be called directly instead of involving whole command machinery for mounting ubifs in generic firmware loader, so some checking codes need to be factored out into cmd_ubifs_mount() without breaking original functionality design.

---
 cmd/ubifs.c         | 22 ++++++++++++++--------
 include/ubi_uboot.h |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)
cmd/ubifs.c +14 -8
index 1710348..e4000b7 100644
@@ -19,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) {
@@ -42,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)
include/ubi_uboot.h +1 -0
index 827dbfc..0770228 100644
@@ -75,6 +75,7 @@ extern int ubi_volume_write(char *volume, void *buf, size_t size);
 extern int ubi_volume_read(char *volume, char *buf, size_t size);
 
 extern struct ubi_device *ubi_devices[];
+int cmd_ubifs_mount(char *vol_name);
 int cmd_ubifs_umount(void);
 
 #endif
Signature · 1 line
2.2.0
#1 lore raw

PATCH v4 2/6 cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

Hello tien.fong.chee,

Am 06.07.2018 um 10:26 schrieb tien.fong.chee at intel.com:

Quoted 7 lines

From: Tien Fong Chee <[email protected]>

cmd_ubifs_mount() function would be called directly instead of involving whole command machinery for mounting ubifs in generic firmware loader, so some checking codes need to be factored out into cmd_ubifs_mount() without breaking original functionality design.

Quoted 6 lines
---
  cmd/ubifs.c         | 22 ++++++++++++++--------
  include/ubi_uboot.h |  1 +
  2 files changed, 15 insertions(+), 8 deletions(-)

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#2 lore raw

PATCH v4 2/6 cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()

In reply to tien.fong.chee at intel.com
Quoted 10 lines · tien.fong.chee at intel.com

From: Tien Fong Chee <[email protected]>

cmd_ubifs_mount() function would be called directly instead of involving whole command machinery for mounting ubifs in generic firmware loader, so some checking codes need to be factored out into cmd_ubifs_mount() without breaking original functionality design.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180929/906d6133/attachment.sig>