]> git.ipfire.org Git - thirdparty/u-boot.git/commit
fs: fat: calculate FAT type based on cluster count
authorChristian Taedcke <christian.taedcke@weidmueller.com>
Wed, 15 Nov 2023 12:44:18 +0000 (13:44 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 29 Nov 2023 01:10:24 +0000 (20:10 -0500)
commit08f622a12708a0a787c8345532e0b1665b993cab
treecb779c9738d596dcb1b5539c10524ff41db372db
parent601d33f31aebf5b76053c501a91a43e0840b1913
fs: fat: calculate FAT type based on cluster count

This fixes an issue where the FAT type (FAT12, FAT16) is not
correctly detected, e.g. when the BPB field BS_FilSysType contains the
valid value "FAT     ".

According to the FAT spec the field BS_FilSysType has only
informational character and does not determine the FAT type.

The logic of this code is based on the linux kernel implementation
from the file fs/fat/inode.c function fat_fill_super().

For details about FAT see http://elm-chan.org/docs/fat_e.html

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
fs/fat/fat.c
include/fat.h