aboutsummaryrefslogtreecommitdiffstats
path: root/libinstaller
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@gmail.com>2011-07-05 22:08:04 +0000
committerPaulo Alcantara <pcacjr@gmail.com>2011-07-05 22:08:04 +0000
commit4d086951a915d3e6faabbff0bd5214444a405658 (patch)
tree1c30d9a7158a0979f4c8ab07bdad91be8d86c4f0 /libinstaller
parent79363f76918fb783ca67a5a7146569db82c81818 (diff)
downloadsyslinux-4d086951a915d3e6faabbff0bd5214444a405658.tar.gz
syslinux-4d086951a915d3e6faabbff0bd5214444a405658.tar.xz
syslinux-4d086951a915d3e6faabbff0bd5214444a405658.zip
implement fat_check_sb_fields()
Sanity check for FAT volumes Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/syslxint.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index 80c40f76..7c9da516 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -247,4 +247,13 @@ struct boot_sector {
#define bsCodeLen (offsetof(struct boot_sector, bsSignature) - \
offsetof(struct boot_sector, bsCode))
+static inline int fat_check_sb_fields(const struct boot_sector *sb)
+{
+ return sb->bsResSectors && sb->bsFATs &&
+ (!memcmp(sb->bs16.FileSysType, "FAT12 ", 8) ||
+ !memcmp(sb->bs16.FileSysType, "FAT16 ", 8) ||
+ !memcmp(sb->bs16.FileSysType, "FAT ", 8) ||
+ !memcmp(sb->bs32.FileSysType, "FAT32 ", 8));
+}
+
#endif /* SYSLXINT_H */