From patchwork Fri Jun 10 07:36:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Izard X-Patchwork-Id: 99854 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0E934B6FE1 for ; Fri, 10 Jun 2011 17:37:50 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 696AE282EE; Fri, 10 Jun 2011 09:37:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SaalaozQB2Ak; Fri, 10 Jun 2011 09:37:48 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B1DA3282DD; Fri, 10 Jun 2011 09:37:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A568282DD for ; Fri, 10 Jun 2011 09:37:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TyBcpNCcQxKN for ; Fri, 10 Jun 2011 09:37:42 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com [74.125.82.172]) by theia.denx.de (Postfix) with ESMTPS id 739C3282D2 for ; Fri, 10 Jun 2011 09:37:40 +0200 (CEST) Received: by wyb29 with SMTP id 29so1719101wyb.3 for ; Fri, 10 Jun 2011 00:37:39 -0700 (PDT) Received: by 10.216.233.207 with SMTP id p57mr1660355weq.72.1307691459462; Fri, 10 Jun 2011 00:37:39 -0700 (PDT) Received: from localhost.localdomain (ram94-11-88-187-113-157.fbx.proxad.net [88.187.113.157]) by mx.google.com with ESMTPS id o75sm1228298weq.40.2011.06.10.00.37.37 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 10 Jun 2011 00:37:38 -0700 (PDT) From: Romain Izard To: U-Boot discussion Date: Fri, 10 Jun 2011 09:36:08 +0200 Message-Id: <1307691368-29196-1-git-send-email-romain.izard.pro@gmail.com> X-Mailer: git-send-email 1.7.0.4 Cc: Romain Izard Subject: [U-Boot] [PATCH] fat: Handle moved FAT32 root directory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The default location of the root directory in a FAT32 partition is the same as its location in a FAT12/16 partition. But a difference is that in FAT32, it is possible for the root directory to move. This fix ensures that the parsing uses the root directory location stored in the PBR, instead of always using the default location. Signed-off-by: Romain Izard --- fs/fat/fat.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index c450bf6..22d34d3 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -798,6 +798,8 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize, if (mydata->fatsize == 32) { mydata->data_begin = mydata->rootdir_sect - (mydata->clust_size * 2); + cursect = mydata->data_begin + + (root_cluster * mydata->clust_size); } else { rootdir_size = ((bs.dir_entries[1] * (int)256 + bs.dir_entries[0]) *