gptfdisk: include gptcl.h after sgdisk.h
This fixes alignment issues with struct sgdisk_partition when used outside sgdisk (eg. in recovery). Also push/pop the pack decls in header files to further fix the issue. Change-Id: If10799ea443ad6870a53494925b4032abb32c542
This commit is contained in:
committed by
Michael Bestas
parent
0d1ea41525
commit
21ddbea48d
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
// A 512-byte data structure into which the MBR can be loaded in one
|
// A 512-byte data structure into which the MBR can be loaded in one
|
||||||
// go. Also used when loading logical partitions.
|
// go. Also used when loading logical partitions.
|
||||||
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
struct TempMBR {
|
struct TempMBR {
|
||||||
uint8_t code[440];
|
uint8_t code[440];
|
||||||
@@ -149,4 +150,6 @@ public:
|
|||||||
void ShowCommands(void);
|
void ShowCommands(void);
|
||||||
}; // class BasicMBRData
|
}; // class BasicMBRData
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3
bsd.h
3
bsd.h
@@ -54,6 +54,7 @@ struct BSDRecord { // the partition table
|
|||||||
// Full data in tweaked BSD format
|
// Full data in tweaked BSD format
|
||||||
// For some reason this has to be packed or MS Visual C++'s debugger complains
|
// For some reason this has to be packed or MS Visual C++'s debugger complains
|
||||||
// about memory errors whenever a BSDData variable is destroyed.
|
// about memory errors whenever a BSDData variable is destroyed.
|
||||||
|
#pragma pack(push)
|
||||||
#pragma pack (8)
|
#pragma pack (8)
|
||||||
class BSDData {
|
class BSDData {
|
||||||
protected:
|
protected:
|
||||||
@@ -88,4 +89,6 @@ class BSDData {
|
|||||||
}; // struct MBRData
|
}; // struct MBRData
|
||||||
#pragma pack ()
|
#pragma pack ()
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3
gpt.h
3
gpt.h
@@ -37,6 +37,7 @@ enum GPTValidity {gpt_valid, gpt_corrupt, gpt_invalid};
|
|||||||
enum WhichToUse {use_gpt, use_mbr, use_bsd, use_new, use_abort};
|
enum WhichToUse {use_gpt, use_mbr, use_bsd, use_new, use_abort};
|
||||||
|
|
||||||
// Header (first 512 bytes) of GPT table
|
// Header (first 512 bytes) of GPT table
|
||||||
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
struct GPTHeader {
|
struct GPTHeader {
|
||||||
uint64_t signature;
|
uint64_t signature;
|
||||||
@@ -212,4 +213,6 @@ public:
|
|||||||
// Function prototypes....
|
// Function prototypes....
|
||||||
int SizesOK(void);
|
int SizesOK(void);
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
// On read of logical entries, it's relative to the EBR record for that
|
// On read of logical entries, it's relative to the EBR record for that
|
||||||
// partition. When writing EBR records, it's relative to the extended
|
// partition. When writing EBR records, it's relative to the extended
|
||||||
// partition's start.
|
// partition's start.
|
||||||
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
struct MBRRecord {
|
struct MBRRecord {
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
@@ -108,4 +109,6 @@ public:
|
|||||||
void ShowData(int isGpt);
|
void ShowData(int isGpt);
|
||||||
}; // MBRPart
|
}; // MBRPart
|
||||||
|
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
#endif // MBRPART_H
|
#endif // MBRPART_H
|
||||||
|
|||||||
@@ -16,11 +16,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "gptcl.h"
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "sgdisk.h"
|
#include "sgdisk.h"
|
||||||
|
#include "gptcl.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user