Makefile.private: correct the names of prerelease tarballs
[syslinux/sherbszt.git] / libfat / fat.h
blobb4e32f762f540a3cea4995df29fb580c31f37825
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
14 * fat.h
16 * Basic data structures for a FAT filesystem
19 #ifndef FAT_H
20 #define FAT_H
22 #include "ulint.h"
24 /* The poor excuse FAT has for a superblock -- in the boot sector */
25 struct fat_bootsect {
26 le8_t bsJump[3]; /* Jump to code */
27 char bsOemName[8]; /* Formatting program */
28 le16_t bsBytesPerSec; /* Bytes/sector */
29 le8_t bsSecPerClust; /* Sectors/cluster */
30 le16_t bsResSectors; /* Reserved sectors */
31 le8_t bsFATs; /* Number of FATs */
32 le16_t bsRootDirEnts; /* Number of entries/root directory */
33 le16_t bsSectors; /* Number of sectors [1] */
34 le8_t bsMedia; /* Magic media type byte */
35 le16_t bsFATsecs; /* Sectors/FAT */
36 le16_t bsSecPerTrack; /* Sectors/track */
37 le16_t bsHeads; /* Number of heads */
38 le32_t bsHiddenSecs; /* Number of hidden sectors */
39 le32_t bsHugeSectors; /* Number of sectors [2] */
40 union {
41 /* FAT12/16 */
42 struct {
43 le8_t bsDriveNumber; /* Drive number */
44 le8_t bsReserved1; /* Reserved */
45 le8_t bsBootSignature; /* 0x29 */
46 le32_t bsVolumeID; /* Volume serial number */
47 char bsVolumeLabel[11]; /* Volume name */
48 char bsFileSysType[8]; /* File system type */
50 le8_t bsCode[448]; /* Boot sector code */
51 } fat16;
53 /* FAT32 */
54 struct {
55 le32_t bpb_fatsz32; /* Sectors/FAT */
56 le16_t bpb_extflags; /* Extended flags */
57 le16_t bpb_fsver; /* Filesystem version */
58 le32_t bpb_rootclus; /* Root directory cluster */
59 le16_t bpb_fsinfo; /* FSINFO sector number */
60 le16_t bpb_bkbootsec; /* Backup boot sector (superblock) */
61 char bpb_reserved[12];
63 /* Same shit, different offset! */
64 le8_t bsDriveNumber; /* Drive number */
65 le8_t bsReserved1; /* Reserved */
66 le8_t bsBootSignature; /* 0x29 */
67 le32_t bsVolumeID; /* Volume serial number */
68 char bsVolumeLabel[11]; /* Volume name */
69 char bsFileSysType[8]; /* File system type */
71 le8_t bsCode[420]; /* Boot sector code */
72 } fat32;
73 } u;
75 le16_t bsSignature; /* 0xAA55 */
78 #define BS_BOOTSIGNATURE 0x29
79 #define BS_SIGNATURE 0xAA55
81 /* A FAT filesystem directory entry */
83 struct fat_dirent {
84 le8_t name[11]; /* Mangled filename */
85 le8_t attribute; /* File type/attribute */
86 le8_t caseflags; /* VFAT: case for basis and extension */
87 le8_t ctime_ms; /* ms of creation time */
88 le32_t ctime; /* Creation time */
89 le16_t atime; /* Date portion (high 16 bits) of atime */
90 le16_t clusthi; /* FAT32: high 16 bits of cluster */
91 le32_t mtime; /* Modification time */
92 le16_t clustlo; /* First cluster pointer */
93 le32_t size; /* File size (bytes) */
96 /* A VFAT filesystem continuation entry */
97 struct fat_vfat_slot {
98 le8_t id; /* Sequence number for slot */
99 le16_t name0[5]; /* 5 characters */
100 le8_t attribute; /* Attribute byte */
101 le8_t reserved; /* Reserved, MBZ */
102 le8_t alias_csum; /* Short name checksum */
103 le16_t name5[6]; /* 6 characters */
104 le16_t firstclust; /* MBZ */
105 le16_t name11[2]; /* 2 characters */
108 #endif /* FAT_H */