[syslinux:lwip] implement fat_check_sb_fields()
syslinux-bot for Paulo Alcantara
pcacjr at gmail.com
Wed Jul 6 10:45:12 PDT 2011
Commit-ID: 4d086951a915d3e6faabbff0bd5214444a405658
Gitweb: http://syslinux.zytor.com/commit/4d086951a915d3e6faabbff0bd5214444a405658
Author: Paulo Alcantara <pcacjr at gmail.com>
AuthorDate: Tue, 5 Jul 2011 22:08:04 +0000
Committer: Paulo Alcantara <pcacjr at gmail.com>
CommitDate: Tue, 5 Jul 2011 22:08:04 +0000
implement fat_check_sb_fields()
Sanity check for FAT volumes
Signed-off-by: Paulo Alcantara <pcacjr at gmail.com>
---
libinstaller/syslxint.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index 80c40f7..7c9da51 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 */
More information about the Syslinux-commits
mailing list