All of lore.kernel.org
 help / color / mirror / Atom feed
From: tien.fong.chee at intel.com <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v10 3/4] cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount()
Date: Mon,  5 Mar 2018 17:43:37 +0800	[thread overview]
Message-ID: <1520243018-105509-4-git-send-email-tien.fong.chee@intel.com> (raw)
In-Reply-To: <1520243018-105509-1-git-send-email-tien.fong.chee@intel.com>

From: Tien Fong Chee <tien.fong.chee@intel.com>

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.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
 cmd/ubifs.c         | 22 ++++++++++++++--------
 include/ubi_uboot.h |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index 0d059ca..8339bed 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -20,16 +20,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 +37,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)
diff --git a/include/ubi_uboot.h b/include/ubi_uboot.h
index 827dbfc..0770228 100644
--- a/include/ubi_uboot.h
+++ b/include/ubi_uboot.h
@@ -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
-- 
2.2.0

  parent reply	other threads:[~2018-03-05  9:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05  9:43 [U-Boot] [PATCH v10 0/4] Generic firmware loader tien.fong.chee at intel.com
2018-03-05  9:43 ` [U-Boot] [PATCH v10 1/4] spl: Remove static declaration on spl_mmc_find_device function tien.fong.chee at intel.com
2018-03-05  9:43 ` [U-Boot] [PATCH v10 2/4] cmd: ubifs: Move ubifs_initialized checking into cmd_ubifs_umount() tien.fong.chee at intel.com
2018-03-05 14:34   ` Tom Rini
2018-03-05  9:43 ` tien.fong.chee at intel.com [this message]
2018-03-05 14:34   ` [U-Boot] [PATCH v10 3/4] cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount() Tom Rini
2018-03-05  9:43 ` [U-Boot] [PATCH v10 4/4] common: Generic firmware loader for file system tien.fong.chee at intel.com
2018-03-06 17:51   ` Simon Glass
2018-03-08  5:03     ` Chee, Tien Fong
2018-03-08 21:04       ` Simon Glass
2018-03-15  7:18         ` Chee, Tien Fong
2018-03-15 12:21           ` Tom Rini
2018-03-08 23:02       ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520243018-105509-4-git-send-email-tien.fong.chee@intel.com \
    --to=tien.fong.chee@intel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.