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: 146411 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3318568ljw; Tue, 11 Sep 2018 00:08:59 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbf4NzWeprTqbZyRSCkqrRcbip/2kt39wTTseGA3O6LUFbJN03vinw/J9M86idkh6PhvDBJ X-Received: by 2002:a50:8dcb:: with SMTP id s11-v6mr26961716edh.86.1536649739347; Tue, 11 Sep 2018 00:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536649739; cv=none; d=google.com; s=arc-20160816; b=hbYzhLXH7czhLzSouW/Ed1P0/omTzY4/HTJI+LtKi2TtqknqKU9UVjY3/rUSB5Ye60 szPBqETcFR/NwNVwv3dYysrPPKZwxNC3/I6AdQV5AvgDayCxBt1FZLT4eRse5CfqgyxV Jk9KjrhsJrsV1DnO6CParTxYZed5VNxP85P+uDQDOeL3l5H/inpIrTsFdq+X2JOC/6Qy wxk4T4dnm1DbUokYb3ErVdsZMzCC5YHk0bDJZAmjNmYICK7cBCl53p8xwVa+FzH9tsHu 3Q2ilep2CBL2F/U2SHB8QNjNKv41B4AROGw4VOtMqdo8tKvCIK0ztxiVLlJX1lwffSrk u6Cg== 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=NvFsatuTR0x63lNbHP5kBahBfki6Gl8FJtk+AR1kmyg=; b=I+Ry6YynashLNRtBai4+HqjS42wlHSK9g9ZkMwOeCjBah5etXRUyqOKRYY/bhioJXu YCtG3OPzut9glOglAckaNN+bvHzBNDtI6lnG+YCkSw+ohxcuWxICblHWA3S5DssDb4U3 CY/hINZwxqGBWBZPEyl7z7IQtKcORsUdi9PiCJWV0ydIWeEoOlpRrm15gc5b77Tq6aLk gULU43ymI3AydD7DYYhnvltUt18gD5zJ7q6zIw0vHXuRHIHIsSxUTuWvmvQQZD0+EScJ Zc6f2wln72CcK5pHjh1nsLU6Fh5OP7uY1Nn0E8LDZ3ElePf2AEk36gHLw72Hc7wQH1XF 9AMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bXWNhjtE; 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 l21-v6si7767038edr.310.2018.09.11.00.08.59; Tue, 11 Sep 2018 00:08:59 -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=bXWNhjtE; 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 DB377C21E89; Tue, 11 Sep 2018 07:05:11 +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-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;