From patchwork Sun Nov 29 02:02:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1407784 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=h0PnF83y; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CkBY04FFXz9s0b for ; Sun, 29 Nov 2020 13:05:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A17F6827B6; Sun, 29 Nov 2020 03:03:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="h0PnF83y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6AE408275B; Sun, 29 Nov 2020 03:03:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BEC4F8277A for ; Sun, 29 Nov 2020 03:02:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606615357; bh=O3kWMxDYZzZx1Zv6Ad87TApUhfa1FVrtEmILx0qAOhE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=h0PnF83yuGRVBIn/y3rCnvHYsLgQEQBRZ7LPSZanjaxsCcD0wDZKypZFmTiP2m7+E FSo5urqaJtlwrKiyWSQgQ8fJFJgMSdFqbn4I3jEgRd0vKCgz9YK+LJLIx86DJUB3mv ewFV56lO/vlD+X7tZFqADnLXharBX4SKEGCD43ug= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from mcbin.fritz.box ([62.143.246.89]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1Mzhj9-1jwkDk22SH-00vdC0; Sun, 29 Nov 2020 03:02:37 +0100 From: Heinrich Schuchardt To: Tom Rini Cc: Simon Glass , Christian Gmeiner , Jason Wessel , AKASHI Takahiro , Marek Szyprowski , Bin Meng , Reuben Dowle , Marcin Juszkiewicz , Thomas Hebb , Samer El-Haj-Mahmoud , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 17/18] fs: fat: first dentry of long name in FAT iterator Date: Sun, 29 Nov 2020 03:02:15 +0100 Message-Id: <20201129020216.4865-18-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201129020216.4865-1-xypron.glpk@gmx.de> References: <20201129020216.4865-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cu2hcPNg/rkUCvegylDs/xxDztzf8kzIG6ArT1NNJ0y4UjQFzEy OfUa8pvW5mnKzE74bx6higt2+plMYXdzOWa6a3Vw8xDy0aQWnWt/hbXvItZbufP1GvYScsQ nFuIWhHafhgU2HsmI1Yw2Fof7cmuew/THYbgNaKAhKuRocOjjp9vDxaKVLQKWelKGc4/BSn 6h2310d+35bnxrXP1Mfew== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z0OGpHoxjBQ=:rQo3iVyKZUBl4QHetRiPOL 2+ve3OTO5SzeWb4pG8ys0hzCGyxlkumvrKDzJkEIWcEb66cnQo5pwSIYgr87uHs/rsIjlSjZM hdGZbLINbturVrqNk0CES0BzKQatcPIj4l8NBUul0ssBlQOAd2bemcm+n3kb0FCeIwno/WA9Q kLZeO5iq7efjAcGE7LipUBUY6Ox1ZmxTnjgrG/qFuTgfVeMIqXJN7HWS+nby03NKckrKalDm1 iLpVRe9ci0Lm4+8aDr1/9mPU0l5OYYxN7FUvc8aF7hqXT8ky58z4BCxyWahOax33tKm/5Ung4 6PLMH0Xx0T/kVJPakhzqqrzZpC1UwKQ/RGhCcMIygZk1E0uTZrWEYy1epy22cORdczNG8QS1F oKYPomHLfML6CrmfIIOJgetV/DbKOAQW0BzYwkT4cSuUSthLwJOM3WVj2+7ejXQUFMmfp+qTF z9HTe7MERPC0e0o1PiG4f7wROBnY0s3EpOS3K+qm6yclM2EURBGJloZ4QhMZq53mJstN8UPgp so/0EM9rxXkpY40ek5nrniX51PEKygPMxV0PgS9LaokT/sHLrkImZ07g2DHkvi8fcGYMg9/FT kCgCnFI8W8ycGRr5Us/2mO7LmxQaviw09AzX7VT4gW6Hq2x/rXkAhHLJK85BDeokmMjm2z+m6 iAiRapcEKfCBli+aBF/Vl6LhvqoSv+HcyumsjFsoX1J/n422uAb6iUDdBuDjuerx0Tt0EzL04 o6wtcQ1NOVZApD5RfjGnx5M5TSGUrx8l+RUj6M6MIm23dOvTbY0xOpjY0IeP1zWH9vp/9iryP ILnSugKxleKiG8R5hoAQsN8EOLRxfm1LjmrHyvUXr6ZwpHCjTPjgJp1CVOwSJC6HshO00uJIG 69rfiBSgX+3RmjH/Q5Sg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean A long name is split over multiple directory entries. When deleting a file with a long name we need the first directory entry to be able to delete the whole chain. Add the necessary fields to the FAT iterator: * cluster of first directory entry * address of first directory entry * remaining entries in cluster Signed-off-by: Heinrich Schuchardt --- fs/fat/fat.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) -- 2.29.2 diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 5a418cfbb7..47344bb57e 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -700,6 +700,18 @@ struct fat_itr { * @dent: current directory entry */ dir_entry *dent; + /** + * @dent_rem: remaining entries after long name start + */ + int dent_rem; + /** + * @dent_clust: cluster of long name start + */ + unsigned int dent_clust; + /** + * @dent_start: first directory entry for long name + */ + dir_entry *dent_start; /** * @l_name: long name of current directory entry */ @@ -966,9 +978,13 @@ static int fat_itr_next(fat_itr *itr) while (1) { dent = next_dent(itr); - if (!dent) + if (!dent) { + itr->dent_start = NULL; return 0; - + } + itr->dent_rem = itr->remaining; + itr->dent_start = itr->dent; + itr->dent_clust = itr->clust; if (dent->name[0] == DELETED_FLAG) continue;