From patchwork Fri Jul 20 02:57:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 142420 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2441011ljj; Thu, 19 Jul 2018 20:04:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfJFMCtSq83LXUsD1U+QX9X2Mrz7b9xcjt96xr7aVPLa3mxL7odTTc92KHCYPO4L8QV49xv X-Received: by 2002:aa7:da9a:: with SMTP id q26-v6mr519621eds.115.1532055880041; Thu, 19 Jul 2018 20:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532055880; cv=none; d=google.com; s=arc-20160816; b=na8ocRWoankHUsou9Ul6TzQdL+A3eUP9FpwV0yp/nbHVg18GA8L5ERTfSvP8A+POZw ILkdbhRsZzkRWIJpeCX1XEooSjJ8OUWRnhhvkq7Rg0HSUSy35Zdj5XklztzpdzYDhFU0 4s46Yg8iZEIphcY5dr9JLZHBd7kTwoZ84OHDiG/yduOr/4AZqy9RP4lpJi4DOeag4TTJ p8r8VBG4A1sY9CKkaCXmWItM3CSJ8NU/cF2s90BDrddRdNuLIttf1S2mVYXttx1AhTqe iNW9fDDnkuy5XPcdyyE4NmHd1i+owFPru+Jc1HMRMwBpzW0Txm1tCmHASYILhHOHPEQ1 TBLA== 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=SIjZ4USAzgStL03M9j3QS/1hGoxX7uNmyZ31MUfvHRE=; b=OhouFXvs+3fewzF2Eu3+j4DnXkPvee6+vEXtUFqpVygHJww8T+k0NcL2IrdlWvDoOA 6bcREJJ3YMeb29EBV1AbQ0RdrgDBNUpoMXg69QOqC2Tc6X0ArYNZC9Y9MLxsR+UxFsnJ vtaKabVu8bJtvNfEEwmlKvV4W8Mznz3c37eYW0HMMgeiftPrNp376bnYnHLDKVMre+Om vdYLlKNmuy6CrlCNk58Uxr6XLUlIAsDgWYrpi+UgUtIITccidAsNO6nRT/QGN9MI++uu SRtYt6gOU73BMShc2s5qcWtPZ3+cVJdKcD2dLWd1BZZ/zcVDbk0Fys0tj03eSSXHMX2L Iqkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Dyyi6WXE; 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 v6-v6si899309edc.281.2018.07.19.20.04.39; Thu, 19 Jul 2018 20:04:40 -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=Dyyi6WXE; 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 A9DDFC21E50; Fri, 20 Jul 2018 03:02:44 +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 264BDC21E39; Fri, 20 Jul 2018 03:02:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 873FDC21DA2; Fri, 20 Jul 2018 02:58:23 +0000 (UTC) Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by lists.denx.de (Postfix) with ESMTPS id D2CC1C21D9A for ; Fri, 20 Jul 2018 02:58:19 +0000 (UTC) Received: by mail-pl0-f67.google.com with SMTP id o7-v6so4506710plk.10 for ; Thu, 19 Jul 2018 19:58:19 -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=PQZD4N1m/ve8xtW5V/Osp4UGVuLos6JSaLBGkr3LNLo=; b=Dyyi6WXEs9W7tIPQCTb3V1orVJS8Pi8je5+Wn91xaR2fMJXzV4K2v92/c6cLauegbL WtimOmI4LzAih6XZHiIGQeZFrZyf+go+TOrHHKttMYKwZj1Eg9CBY6IlXZWWpOr312u2 qPHYDNTMsUqcJFaj3+TSgopl49LuT4xKC2TvY= 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=PQZD4N1m/ve8xtW5V/Osp4UGVuLos6JSaLBGkr3LNLo=; b=rxCFqVswS5MiZoZgpmmfy70f6f/ExyBfSKfSnhQzHJoj4kBG/6ZayzrHkT/nPUZUdO Uu6jKSde/IpyxBRZ3PSvbd3Ld7EUuFaeSA8W76FjVqM3O43ZlTaNjF57f6ap2fIBEuLR hojCloaQTdfsKQfek19v+VX82cn73k5us7uUtqocVrGS6tz+ulAx/WWEpvU2aXmzLMnS aqZuv19u4FYM7/wL3n1AtBFGD8KNrjp0yu+2fakMLGDaiGoxf2FYe2KWaoJbWcKdp4DR KTcr5VPNHkIcogLm7DYWQu5D3h7s/YVPJxTzpufB5lXv+d/sPzMBvHrzZ7OA9AZDP1kU nTCg== X-Gm-Message-State: AOUpUlGQx0m7TLVwLvHSGJNjH3mwQV46ztPuu4ikh9iiAlPMzIdbM3mQ /Z9bv0KETGguLO6+UKuLwD4ayw== X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr256141pll.343.1532055498568; Thu, 19 Jul 2018 19:58:18 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id l190-v6sm509987pgl.75.2018.07.19.19.58.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 19:58:17 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com Date: Fri, 20 Jul 2018 11:57:18 +0900 Message-Id: <20180720025723.6736-13-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180720025723.6736-1-takahiro.akashi@linaro.org> References: <20180720025723.6736-1-takahiro.akashi@linaro.org> Cc: u-boot@lists.denx.de, xypron.glpk@gmx.de, agraf@suse.de Subject: [U-Boot] [PATCH 12/17] 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 9bafc3a40c..ade5264551 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -639,6 +639,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; @@ -674,6 +675,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 bc0f77abb5..295da0f243 100644 --- a/include/fat.h +++ b/include/fat.h @@ -197,6 +197,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 */