On gcc the packed attribute is supposed to not work when you use

a typedef in the struct definition. Then packing the whole struct
and each member is redundant. So cleanup __PACKED usage and
hopefully both shut up gcc warnings and keeps things working :).
This commit is contained in:
riccardom 2009-08-04 20:49:19 +00:00
parent 7324afeafd
commit 4029f105d8
1 changed files with 41 additions and 39 deletions

View File

@ -27,59 +27,61 @@
#endif
#include "PACKED.h"
typedef struct
struct boot_record
{
u8 jmpBoot[3] __PACKED;
u8 OEMName[8] __PACKED;
u8 jmpBoot[3];
u8 OEMName[8];
// BIOS Parameter Block
u16 bytesPerSector __PACKED;
u8 sectorsPerCluster __PACKED;
u16 reservedSectors __PACKED;
u8 numFATs __PACKED;
u16 rootEntries __PACKED;
u16 numSectorsSmall __PACKED;
u8 mediaDesc __PACKED;
u16 sectorsPerFAT __PACKED;
u16 sectorsPerTrk __PACKED;
u16 numHeads __PACKED;
u32 numHiddenSectors __PACKED;
u32 numSectors __PACKED;
u16 bytesPerSector;
u8 sectorsPerCluster;
u16 reservedSectors;
u8 numFATs;
u16 rootEntries;
u16 numSectorsSmall;
u8 mediaDesc;
u16 sectorsPerFAT;
u16 sectorsPerTrk;
u16 numHeads;
u32 numHiddenSectors;
u32 numSectors;
struct
{
// Ext BIOS Parameter Block for FAT16
u8 driveNumber __PACKED;
u8 reserved1 __PACKED;
u8 extBootSig __PACKED;
u32 volumeID __PACKED;
u8 volumeLabel[11] __PACKED;
u8 fileSysType[8] __PACKED;
u8 driveNumber;
u8 reserved1;
u8 extBootSig;
u32 volumeID;
u8 volumeLabel[11];
u8 fileSysType[8];
// Bootcode
u8 bootCode[448] __PACKED;
u16 signature __PACKED;
u8 bootCode[448];
u16 signature;
} __PACKED fat16;
} __PACKED BOOT_RECORD;
} __PACKED;
typedef struct boot_record BOOT_RECORD;
#include "PACKED_END.h"
// Directory entry - must be packed
#include "PACKED.h"
typedef struct
struct dir_ent
{
u8 name[NAME_LEN] __PACKED;
u8 ext[EXT_LEN] __PACKED;
u8 attrib __PACKED;
u8 reserved __PACKED;
u8 cTime_ms __PACKED;
u16 cTime __PACKED;
u16 cDate __PACKED;
u16 aDate __PACKED;
u16 startClusterHigh __PACKED;
u16 mTime __PACKED;
u16 mDate __PACKED;
u16 startCluster __PACKED;
u32 fileSize __PACKED;
} __PACKED DIR_ENT;
u8 name[NAME_LEN];
u8 ext[EXT_LEN];
u8 attrib;
u8 reserved;
u8 cTime_ms;
u16 cTime;
u16 cDate;
u16 aDate;
u16 startClusterHigh;
u16 mTime;
u16 mDate;
u16 startCluster;
u32 fileSize;
} __PACKED;
typedef struct dir_ent DIR_ENT;
#include "PACKED_END.h"
#endif //