From patchwork Tue Sep 4 07:49:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 145870 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3374417ljw; Tue, 4 Sep 2018 01:04:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdapVXO1tHlcBvxRkYL3KV881TZdA2BMKyS7VS1dW5yvnEWAr1Kc5DZYkhBw86zKPc0T0AEW X-Received: by 2002:a50:8ea1:: with SMTP id w30-v6mr35469044edw.197.1536048283730; Tue, 04 Sep 2018 01:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536048283; cv=none; d=google.com; s=arc-20160816; b=Do3xd8xmDRuL6Bb1QPpCf6TMQJ5dgoZC2y/OlBojH3YcFLGxHtlXccW/J+2OHZDeL4 vNJn6VfUPsGBQ2xIt22QAv+4xKlgt/BBOFPbISdhWTmRcbX4D3AxRmFCFvGrDrSMOaOI LCZr4TdZp3E74wVdBD4B10bRFEwJMrd2DU8oF6kjXVAKfp4f9p3vKwTkNL/UgI0fWKwD kUDuJWuiBMbrJvoZ0s9EKAAoI/Rrl6H+WdVqnulaqOthEAyfODrlXKFDPteDvkD5y0hp wwtLwp/oEj6KQv7uUEnJG4pf2BQky+wpIg68vwUTtnzcNeLVENkxtDZ28NjIEno1WCBu UUAQ== 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=+7txp4mwSEZ+Tf6HrXA+7nus08wXv+6H1MlZZ5lw3j0=; b=ODMJfKa0EeqG800aRfHsqwK1MuqK9HAuNN/c5o5su8jmR/J1+rGHYZhbZ0s19C0XRX a//yjiRPvnm5DJtZOAk5Ykq8xMSvoQdWtJjOCVjv+e/2SfW+h3kdLmhVCruBTv83uqE9 YcgSbJK2Fyoalv5QFbmuEwSpXwfIJ5MhJFblh0pyMK70QloAFfWxkebP/GvF31LJXhBZ kkKaon8fMj36LhQCJAUD1FXOgXSc3iM3ElqdjIwTZZNS8FBU8t9oTXhbSbScHRywVrkt liA36/+WcDGmP+iVQAKlThG5zj14XmqICs9JvKE8XNu0iYUO+lsLl3up744mXEhK9q9T Vlqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZE17fQ3L; 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 y36-v6si8682011ede.17.2018.09.04.01.04.43; Tue, 04 Sep 2018 01:04:43 -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=ZE17fQ3L; 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 2BE55C21F71; Tue, 4 Sep 2018 08:01:00 +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 0C263C21F4D; Tue, 4 Sep 2018 08:00:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D53B4C21F00; Tue, 4 Sep 2018 07:52:13 +0000 (UTC) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by lists.denx.de (Postfix) with ESMTPS id 1FABBC21F38 for ; Tue, 4 Sep 2018 07:52:09 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id j26-v6so1273242pfi.10 for ; Tue, 04 Sep 2018 00:52:09 -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=3jEU+po+IuyaRobaR3DZQwoIopckEtDLvCm3BLnsfns=; b=ZE17fQ3Lgp4KihKjf1HAwYE2mQr9X3k+0znAb042jj/sAKC7v6eprBTj+5mBDppDk9 aC2fO07pjd1Tutlpb3sXsz5O6VVrlQmRzAMAH76mJWosVUzOkOvXowac3pmMa/Zmpjpy xzb947PDqxxObmaoMqzgY0mLmYuu2DgwB79yE= 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=3jEU+po+IuyaRobaR3DZQwoIopckEtDLvCm3BLnsfns=; b=GsxU/77+EsjzRbaR/a7EivEAgjuBLIQvlkIxItyBRnrMV3EnQ6cWm5bEQOyaJB4Km/ q6vgHCOB0KIOqZ8YJ5vWax4wwd1waH4v/vzg+LVH68zwP+zZpljOWm8OkvJfrCuOIDib QkoqKGQWgwfqUhYRbxoz0RsCBmtE+0ZvNdEjGt9ajKEHp2qQZV0ucklNEIz0KVsfagrZ Nrzi7rbm0YUWsO2XJQ36kc/y07sKLhdE3TQBXXsqi/Qk8HxS1yN1+sNFCeE8/FSA1mOd e+Stix681m4MmTk3YPbrqarM5lKKXAj0UE/qnJnTzT0GPXlOTGQWW9CmdBngEsmUx5j5 w1uA== X-Gm-Message-State: APzg51BD7mJLjbQ5C/MkK2EIK7EJHpB/j7/asAJuvRVG43eVyPzpawac EpPgT0sgJFBTj0Cjp3b7GevnMg== X-Received: by 2002:a65:49cc:: with SMTP id t12-v6mr30020329pgs.27.1536047527824; Tue, 04 Sep 2018 00:52:07 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id a20-v6sm48768497pfc.14.2018.09.04.00.52.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 00:52:07 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com Date: Tue, 4 Sep 2018 16:49:39 +0900 Message-Id: <20180904074948.18146-15-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 14/23] fs: fat: remember the starting cluster number of directory 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" The starting cluster number of directory is needed to initialize ".." (parent directory) entry when creating a new directory. Signed-off-by: AKASHI Takahiro --- fs/fat/fat.c | 2 ++ include/fat.h | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 50c2d4f3c33d..bbd4b098afb5 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -643,6 +643,7 @@ int fat_itr_root(fat_itr *itr, fsdata *fsdata) return -ENXIO; itr->fsdata = fsdata; + itr->start_clust = 0; itr->clust = fsdata->root_cluster; itr->next_clust = fsdata->root_cluster; itr->dent = NULL; @@ -678,6 +679,7 @@ void fat_itr_child(fat_itr *itr, fat_itr *parent) assert(fat_itr_isdir(parent)); itr->fsdata = parent->fsdata; + itr->start_clust = clustnum; if (clustnum > 0) { itr->clust = clustnum; itr->next_clust = clustnum; diff --git a/include/fat.h b/include/fat.h index 9b114e3cbda4..05a993bfdcfe 100644 --- a/include/fat.h +++ b/include/fat.h @@ -199,6 +199,7 @@ static inline u32 sect_to_clust(fsdata *fsdata, int sect) typedef struct { fsdata *fsdata; /* filesystem parameters */ + unsigned start_clust; /* first cluster */ unsigned clust; /* current cluster */ unsigned next_clust; /* next cluster if remaining == 0 */ int last_cluster; /* set once we've read last cluster */