2 * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de.
3 * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved.
5 * Distributed under the terms of the MIT License.
19 Header(int fd
, uint64 lastBlock
,
22 // constructor for empty header
23 Header(uint64 lastBlock
, uint32 blockSize
);
27 status_t
InitCheck() const;
29 uint64
FirstUsableBlock() const
30 { return fHeader
.FirstUsableBlock(); }
31 uint64
LastUsableBlock() const
32 { return fHeader
.LastUsableBlock(); }
34 uint32
EntryCount() const
35 { return fHeader
.EntryCount(); }
36 efi_partition_entry
& EntryAt(int32 index
) const
37 { return *(efi_partition_entry
*)(fEntries
38 + fHeader
.EntrySize() * index
); }
41 status_t
WriteEntry(int fd
, uint32 entryIndex
);
42 status_t
Write(int fd
);
47 status_t
_WriteHeader(int fd
);
48 status_t
_Write(int fd
, off_t offset
, const void* data
,
51 void _UpdateCRC(efi_table_header
& header
);
54 status_t
_Read(int fd
, off_t offset
, void* data
,
56 static bool _IsHeaderValid(efi_table_header
& header
,
58 static bool _ValidateHeaderCRC(efi_table_header
& header
);
59 bool _ValidateEntriesCRC() const;
60 void _SetBackupHeaderFromPrimary(uint64 lastBlock
);
61 size_t _EntryArraySize() const
62 { return fHeader
.EntrySize()
63 * fHeader
.EntryCount(); }
65 const char* _PrintGUID(const guid_t
& id
);
66 void _Dump(const efi_table_header
& header
);
67 void _DumpPartitions();
72 efi_table_header fHeader
;
73 efi_table_header fBackupHeader
;
81 #endif // GPT_HEADER_H