From patchwork Tue Sep 11 06:59:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 146410 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3318262ljw; Tue, 11 Sep 2018 00:08:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYpJOu39R7K3KHzJxt9u9xWo+dQaXMZ4n1NqeHHY1Ayhi4MwuUJAfRYh4jFniJVyZ3e7Muo X-Received: by 2002:a50:8b65:: with SMTP id l92-v6mr27115921edl.44.1536649722395; Tue, 11 Sep 2018 00:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536649722; cv=none; d=google.com; s=arc-20160816; b=RCc5cTOwwQ6lFMyS5EvtvAzVZ6y/OdjqvmX5vkroCHBnUOqS67JjYxya6dKnam4N+T e6QR8kN3u5cXhZfzVb6Zzmg4fU8hSFkbhJiHIHBCGFQbbB0e4cBkHB3lKWprjdOLnIEo fHNMkU0XYQjqoVnhRgkesycR2YJN+1CYF93DgO2VxJPCA05n47uQs0lkS2e9dE7Ud3f8 0YDZyDrLs5huQSirKGGUt3TWGxixvndzuMRTf9XCCoK/cXC/wEl+X37EfVPzLIeVNRyT 99cEK0k5brxUMYwAqJscBnbv9hBb31wNFLWFB1C9Rj/oSRJjL/sNr+Vd7fRvamVtIRHI RvCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature; bh=yriI+vRxf9WXzirczYqLujZ6Fc7F7vfUaZ4WCW0yY4E=; b=VcU/NUWJpbPM3ZmpkaSkMkeY29+VzsczFmvKRYK3mjxVlf8vP6cUhd23aPXG3e6cRh UQFN4uUc3nx2WZU5/2zfr/U93CWJ8QH20iNPI+R0J1tU4hEu9QCRREjFUT+ukTuxMI1o fFJiOdo/aKLoXsnIZ+ESh5P1rcytl3sS3l53DFQ4GSFsHGEA+M6vxRTLmGYwOpPEXKF5 2LcXTgjsytGQEnvLL8LQ1G/p1D07Vo9kOEAvK8wBSWHwVYZoWvoyUKdhQh39YGByU4yr Jh5AEfX00/wbSvz4ZOfJJ5uuAWmwCVh1NUqpEzT7p/LoTbLG5i6DVqeS9dWV5OfuHjBG N0Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SpOOoJdE; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j3-v6si6472738edh.183.2018.09.11.00.08.42; Tue, 11 Sep 2018 00:08:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SpOOoJdE; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id CDCF9C21E75; Tue, 11 Sep 2018 07:04:13 +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_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID 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 9402AC21EBB; Tue, 11 Sep 2018 07:00:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4328BC21F13; Tue, 11 Sep 2018 06:59:55 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by lists.denx.de (Postfix) with ESMTPS id A61C6C21E52 for ; Tue, 11 Sep 2018 06:59:47 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id d19-v6so11766917pgv.1 for ; Mon, 10 Sep 2018 23:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MZY5qHI+Lk5hLrjvrMRhBcO625AKCyNEKJYLQg7vrps=; b=SpOOoJdEjx1R/QIadMF2w/jAh/6vgAm1VgihMtCgOoqMUsMk873Wsmx/E/HoY15HWh 8bOIM1ZjmAKL7estyTGkWPZGWzeKuuWLXYwl3Heyj4s8OyHca6e9bybxOOUsbbrtknOx PIs3J5H+ZLFnY/fDz4nAxwLrMq4WRcFnWlZ2U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MZY5qHI+Lk5hLrjvrMRhBcO625AKCyNEKJYLQg7vrps=; b=nt0JxAWEnGOrhcm1LkIBgApx+OJUBZwb1EYmtFTeIOWiMI29JvpHPUuAZcC26qevE1 sp/OsPw/VXOJKdqIjaNew9g+QTBHmhD/Ufq5d0rkwKPANGMj7oQRaSZc0JySrwcvPav3 HgU4CiNKL5Usc1nEXSnfIeYZWN6dXurLs28iGaKq2qkKe09NdTw+oCaHLl1XnWp+bgvO mT2lQ5Rie9guq1jfLc5JMWRj1FSdvhLMhkDi6ljQzI5FN9Tdil4nIpNLC2RUz1rTQQrg 8JB4Yg35okh11n9AvH+imDcDg1n0vHlj8iDv27OfglKsASMSM53k7NJgEUO03Vg/A5Iv n0Ww== X-Gm-Message-State: APzg51Cr0qhREWojd1qwV6uw+jPPpX9sNEk9ZmfTVmcFk+IvfwhVZQAW 6nEVxJ8TJ0uBqjnORlVFrHBEuw== X-Received: by 2002:a62:9894:: with SMTP id d20-v6mr27790560pfk.186.1536649183602; Mon, 10 Sep 2018 23:59:43 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 22-v6sm27180185pfl.126.2018.09.10.23.59.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 23:59:42 -0700 (PDT) From: "Akashi, Takahiro" To: trini@konsulko.com Date: Tue, 11 Sep 2018 15:59:07 +0900 Message-Id: <20180911065922.19141-12-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180911065922.19141-1-takahiro.akashi@linaro.org> References: <20180911065922.19141-1-takahiro.akashi@linaro.org> Cc: u-boot@lists.denx.de, xypron.glpk@gmx.de, agraf@suse.de Subject: [U-Boot] [PATCH v3 11/26] cmd: fat: add offset parameter to fatwrite 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: AKASHI Takahiro In this patch, fatwrite command is extended so as to accept an additional parameter of file offset. Signed-off-by: AKASHI Takahiro --- cmd/fat.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/fat.c b/cmd/fat.c index 03de5d11afb4..2a5f7bfc2690 100644 --- a/cmd/fat.c +++ b/cmd/fat.c @@ -104,6 +104,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag, int ret; unsigned long addr; unsigned long count; + long offset; struct blk_desc *dev_desc = NULL; disk_partition_t info; int dev = 0; @@ -126,9 +127,11 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag, } addr = simple_strtoul(argv[3], NULL, 16); count = (argc <= 5) ? 0 : simple_strtoul(argv[5], NULL, 16); + /* offset should be a hex, but "-1" is allowed */ + offset = (argc <= 6) ? 0 : simple_strtol(argv[6], NULL, 16); buf = map_sysmem(addr, count); - ret = file_fat_write(argv[4], buf, 0, count, &size); + ret = file_fat_write(argv[4], buf, offset, count, &size); unmap_sysmem(buf); if (ret < 0) { printf("\n** Unable to write \"%s\" from %s %d:%d **\n", @@ -142,9 +145,9 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag, } U_BOOT_CMD( - fatwrite, 6, 0, do_fat_fswrite, + fatwrite, 7, 0, do_fat_fswrite, "write file into a dos filesystem", - " []\n" + " [ []]\n" " - write file 'filename' from the address 'addr' in RAM\n" " to 'dev' on 'interface'" );