From 010ee209b75c5732ae4144e3ee9ce14158193c1f Mon Sep 17 00:00:00 2001 From: Franck Jullien Date: Wed, 19 Sep 2012 13:09:01 +0200 Subject: filetype: Improve FAT detection We may have some disk with MBR as a first sector. In this case, the current FAT check returns an error. However, the FAT sector exist and the MBR can tell us where it is. This patch add to file_name_detect_type function the ability to find the FAT boot sector on the first sector of the first partition in case it is not on sector 0. It also introduce is_fat_or_mbr to check if a buffer is a FAT boot or MBR sector Signed-off-by: Franck Jullien Signed-off-by: Sascha Hauer --- include/filetype.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/filetype.h') diff --git a/include/filetype.h b/include/filetype.h index 179ec0f5eb..37eb62020d 100644 --- a/include/filetype.h +++ b/include/filetype.h @@ -19,10 +19,12 @@ enum filetype { filetype_sh, filetype_mips_barebox, filetype_fat, + filetype_mbr, }; const char *file_type_to_string(enum filetype f); enum filetype file_detect_type(void *_buf); enum filetype file_name_detect_type(const char *filename); +enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec); #endif /* __FILE_TYPE_H */ -- cgit v1.2.3