From patchwork Tue Sep 4 07:49:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 145865 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3369840ljw; Tue, 4 Sep 2018 01:00:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY3KBICLNCKtls9wOqOXVG5qMxt5lcWTDqz91PLVO0bfMbuBo/4dqJc0ynkK2IzOYpeR8PZ X-Received: by 2002:a50:fa0a:: with SMTP id b10-v6mr35554139edq.138.1536048013617; Tue, 04 Sep 2018 01:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536048013; cv=none; d=google.com; s=arc-20160816; b=D2oYIz5x48DxxbTLl7ORgeZFl8fFx6RDMAFrNoPnawM5PkGPoZU19UcDhJ3Ca2tv7M GYA/6i6D1kwIi52f8oy2hqJc5SdFdivSoTBulVw1K7xWGl7zJZ9d+3hcfD8na0PfBwh2 jTAg3frvNSpTCr6BMdE95aAJVFSLsWR/ahweZLEOVF1rpnyRJcW/pmngXeEGEQkb15Sd s5PP+ukW74b+4+F8rw6y5Jhnbstzw8JA3ISLBAqQmVJENY03f5+dkqp0yKaDW3u6jeCo 87uiM9k1bfCEAs7pmeLpZcvqrG0+Fp9Zgz4fKoz3AL8ZidTe0NDQlAId+1EYmSgBm/WF ryjw== 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:arc-authentication-results; bh=lQOpiGIFJBkE8j3fJxdHzxZA6pxUJc+QMxm4HCItZzw=; b=AvNb0LHYRsTZdky9dhJnkuGZesceHKMIGKKFG/nt/bE8IKFhyFhUKSj+0umF96WOXC ScKNuAdSzDdiJKC/NI/ajVRUOvzxfG3Y69nGeiyuw093eem/kcQjxIL9cVNVsF8Ejb8E lk+RlsIlN7AIqNleQSX18YmVjECpj4k6TYo+CJN0rM6YijQnb4T5roTMqkRA/p/d5wYV pZ/li2xC1Tbtkyqh9q3LbA3IKfy/vFO/ww7o6PjX5r5wKEhGWpk0kJFqLkPvM5n5oHsv n46tPY+IFaPBrlE0YBvhhWpg/Ane5ftXyrnPM1WoyQN+A3brr3gl7n7Hd54EXB1URd0Q Ms7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="hZ8nI/iX"; 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 b100-v6si8218744edf.286.2018.09.04.01.00.13; Tue, 04 Sep 2018 01:00:13 -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="hZ8nI/iX"; 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 3288AC21F6A; Tue, 4 Sep 2018 07:53:18 +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 141CDC21F4A; Tue, 4 Sep 2018 07:52:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id ABF2DC21F3D; Tue, 4 Sep 2018 07:51:55 +0000 (UTC) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by lists.denx.de (Postfix) with ESMTPS id 8BED4C21EA2 for ; Tue, 4 Sep 2018 07:51:54 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id k21-v6so1268215pff.11 for ; Tue, 04 Sep 2018 00:51:54 -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=DHFvjeOmhKQ3GLYF5Mk7C5kpkZKBhEFreRCeYZsCrW0=; b=hZ8nI/iXeeHg2GBcDVj//tpFXocW7SGR2H7Kqx5mnZrsBI8WUqKW74pCPYE+XsELCs XKFzGer6peG5n2twCb25QJ6Z+Zp91vI9d1mCVZ92+6FD6HQlo982Lz1c9A95zhN3fqyU 0t79SX3Pc/u3F9wOsoG9faiWwDhIGQZNO3AFU= 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=DHFvjeOmhKQ3GLYF5Mk7C5kpkZKBhEFreRCeYZsCrW0=; b=cptJ0Z0lXIFFYZojvs8p7+CYTunXeguCL17MXJ3eP1MOlsrAOpYU/XykH1nbVrN9oo YRjslMuj4ZoX7XsKQicGCfVd6OhqA0Mh6+WR2q1Vb3D0P20PGK8HZFVXpswwOUl3Akf3 kT9ce+8IuYZwOp/SQBiBHitSuDsUfhVyIHzvzxFUqGBl/DkbtN/eKy7SL9H+N66VC1BQ /xdvkTJJwPJ9Im4rdel6HqfC+UlBbSVwvWpRUcaM2nHzq5r0z9fW+HBXrFHBvprP7YaW Gc1SFsgWzGy8FyET0dnAnBe2Hwg5tVMv6gBMggzDgaAB3v30Ik0EW9C3u+WvW9jOSbAm v8Gw== X-Gm-Message-State: APzg51BNSRye7In7LSvzrmvSBfLB5pOEN10e7AuhDeslI94FKoZCYFku ORYiYTnTxDfznag9BVBjZ/Sh6prC7eQ= X-Received: by 2002:a63:88c8:: with SMTP id l191-v6mr30024242pgd.340.1536047513245; Tue, 04 Sep 2018 00:51:53 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id 5-v6sm27063002pgc.86.2018.09.04.00.51.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 00:51:52 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com Date: Tue, 4 Sep 2018 16:49:37 +0900 Message-Id: <20180904074948.18146-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180904074948.18146-1-takahiro.akashi@linaro.org> References: <20180904074948.18146-1-takahiro.akashi@linaro.org> Cc: xypron.glpk@gmx.de, agraf@suse.de, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 12/23] 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" 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'" );