From: Thomas RIENOESSL Date: Tue, 13 Nov 2018 13:41:33 +0100 Subject: [U-Boot] [PATCH] fs: fat: assign rootdir sector when accessing root directory Message-ID: <20181113124133.31226-1-thomas.rienoessl@bachmann.info> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This fixes problems accessing drives formated under Windows as FAT16. Change-Id: Ideeca97525d3009b99de35b017707af11fda27c1 Signed-off-by: Thomas RIENOESSL --- fs/fat/fat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 4b722fc5ca..7b7d43d997 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -720,7 +720,10 @@ static void *next_cluster(fat_itr *itr) if (itr->last_cluster) return NULL; - sect = clust_to_sect(itr->fsdata, itr->clust); + if (itr->is_root) + sect = mydata->rootdir_sect; + else + sect = clust_to_sect(itr->fsdata, itr->clust); debug("FAT read(sect=%d), clust_size=%d, DIRENTSPERBLOCK=%zd\n", sect, itr->fsdata->clust_size, DIRENTSPERBLOCK); -- 2.19.1