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: 965823 X-Patchwork-Delegate: trini@ti.com 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=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZE17fQ3L"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 424KBy3JxCz9sfN for ; Tue, 4 Sep 2018 18:05:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0C90BC21F4D; 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-Google-Smtp-Source: ANB0VdagLOgAsXBQpHbZT6lUtSQ2kpwkpLxUpFpLikoqYQjDC1LDK3iT3/t+9FnPhp/6WBRj8Q8xiQ== 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 */