From patchwork Tue Sep 11 06:59:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 968437 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="bXWNhjtE"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 428bZ46hB7z9s7T for ; Tue, 11 Sep 2018 17:06:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7A7F5C21E7F; Tue, 11 Sep 2018 07:05: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 4CD63C21E75; Tue, 11 Sep 2018 07:00:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4B035C21E90; Tue, 11 Sep 2018 06:59:58 +0000 (UTC) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by lists.denx.de (Postfix) with ESMTPS id 23972C21EEB for ; Tue, 11 Sep 2018 06:59:53 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id b129-v6so11732895pga.13 for ; Mon, 10 Sep 2018 23:59:53 -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=wXq93k54/Qh9tf236I4soQCnb40ier46I9ZQ615Gzlk=; b=bXWNhjtEhayaKzm+xg4eHH5J3/5coX5MVX9QgY1PblHMOItqBTc0dYT4LIRDiejtaY Mpo+wzrpllNf88K08TJhf/z3KtRe3bhwy5Zmaulx48Tkfnp/LrM4QkbTWTsv0B5eVkI/ GXFdO/4smEVhUb9yfdoPukiHZH5jOT6L+Y+FI= 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=wXq93k54/Qh9tf236I4soQCnb40ier46I9ZQ615Gzlk=; b=U9hSMMFSoUKjMc2UISZ8F6BKtSRDEwHm0mGaubnazykgBQSj8AB/fsyjKboCm/vmlM cMUIU+XEGG0vuhSymSemvb3xQNaoFLojVHUMGTU+EAq/k5MvMlmo5ibh24A7+UzCKyxF GaqNjMMp/oILo+PWPQGHJGhev5UTd3ZPlxnkIm9hcpuCofNzYSFHDCvst8Iw98Ou4V/B tuuwD3LY5sMX+U6+7E1iOjM/Xwjw2bcz+Auyptvr3NpHfq4Rio7yTOagz6nx0/POofm0 8+KxCJZSm55+XJcDfBA5MrsckFB+nDTErg8H1T48u8vgvRqXpWBhm0l1qKuqDXBnoUiT m9WA== X-Gm-Message-State: APzg51DRlW1rwsLCQROg3FlJnxU6hygLaGxko82504D1t7xadsyijLe3 mxytKnlTHMwuf7MI3hXOxcBrOw== X-Google-Smtp-Source: ANB0VdbnCbVX8L9R7A2mbBoVcNgNZ7/GOi6pw85ZUP7NVI5YflGUvD5MR0m9xNid/aQT+38gdQFayA== X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr27707583pfg.185.1536649191733; Mon, 10 Sep 2018 23:59:51 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id e64-v6sm25589237pfk.87.2018.09.10.23.59.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 23:59:51 -0700 (PDT) From: "Akashi, Takahiro" To: trini@konsulko.com Date: Tue, 11 Sep 2018 15:59:09 +0900 Message-Id: <20180911065922.19141-14-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 13/26] 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" From: AKASHI Takahiro 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 5aa28656c7d5..10741925bdd4 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -631,6 +631,7 @@ static int get_fs_info(fsdata *mydata) 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 */ @@ -663,6 +664,7 @@ static 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; @@ -698,6 +700,7 @@ static 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;