From patchwork Tue Feb 27 05:21:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chee, Tien Fong" X-Patchwork-Id: 878322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zr6Zl2d9wz9s15 for ; Tue, 27 Feb 2018 16:24:47 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1EB46C2219E; Tue, 27 Feb 2018 05:23:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 84534C2218E; Tue, 27 Feb 2018 05:22:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 15A00C22158; Tue, 27 Feb 2018 05:22:16 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lists.denx.de (Postfix) with ESMTPS id B5179C22158 for ; Tue, 27 Feb 2018 05:22:11 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2018 21:22:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,398,1515484800"; d="scan'208";a="207248055" Received: from pg-iccf0267.altera.com ([10.104.1.71]) by fmsmga005.fm.intel.com with ESMTP; 26 Feb 2018 21:22:08 -0800 From: tien.fong.chee@intel.com To: u-boot@lists.denx.de Date: Tue, 27 Feb 2018 13:21:56 +0800 Message-Id: <1519708917-21848-4-git-send-email-tien.fong.chee@intel.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1519708917-21848-1-git-send-email-tien.fong.chee@intel.com> References: <1519708917-21848-1-git-send-email-tien.fong.chee@intel.com> Cc: Marek Vasut , Tom Rini , Tien Fong Chee , Ching Liang See , Tien Fong , Westergteen Dalon Subject: [U-Boot] [PATCH v9 3/4] cmd: ubifs: Factor out some checking codes into cmd_ubifs_mount() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Tien Fong Chee 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 Reviewed-by: Marek Vasut --- 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