srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 1 | /* mbr.h -- MBR data structure definitions, types, and functions */ |
| 2 | |
Roderick W. Smith | e3ee733 | 2013-09-24 12:56:11 -0400 | [diff] [blame] | 3 | /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 4 | under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ |
| 5 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 6 | #include <stdint.h> |
| 7 | #include <sys/types.h> |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 8 | #include "gptpart.h" |
srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 9 | //#include "partnotes.h" |
srs5694 | 546a9c7 | 2010-01-26 16:00:26 -0500 | [diff] [blame] | 10 | #include "diskio.h" |
srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 11 | #include "basicmbr.h" |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 12 | |
| 13 | #ifndef __MBRSTRUCTS |
| 14 | #define __MBRSTRUCTS |
| 15 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 16 | using namespace std; |
| 17 | |
| 18 | /**************************************** |
| 19 | * * |
| 20 | * MBRData class and related structures * |
| 21 | * * |
| 22 | ****************************************/ |
| 23 | |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 24 | // Full data in tweaked MBR format |
srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 25 | class MBRData : public BasicMBRData { |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 26 | protected: |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 27 | public: |
srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 28 | MBRData(void) {} |
| 29 | MBRData(string deviceFilename) : BasicMBRData(deviceFilename) {} |
srs5694 | bf8950c | 2011-03-12 01:23:12 -0500 | [diff] [blame] | 30 | MBRData & operator=(const BasicMBRData & orig); |
srs5694 | 978041c | 2009-09-21 20:51:47 -0400 | [diff] [blame] | 31 | |
| 32 | // Functions to create, delete, or change partitions |
| 33 | // Pass EmptyMBR 1 to clear the boot loader code, 0 to leave it intact |
srs5694 | 978041c | 2009-09-21 20:51:47 -0400 | [diff] [blame] | 34 | void MakeProtectiveMBR(int clearBoot = 0); |
srs5694 | e4ac11e | 2009-08-31 10:13:04 -0400 | [diff] [blame] | 35 | void OptimizeEESize(void); |
srs5694 | 64cbd17 | 2011-03-01 22:03:54 -0500 | [diff] [blame] | 36 | int DeleteByLocation(uint64_t start64, uint64_t length64); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 37 | |
| 38 | // Functions to extract data on specific partitions.... |
srs5694 | 221e087 | 2009-08-29 15:00:31 -0400 | [diff] [blame] | 39 | GPTPart AsGPT(int i); |
srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame] | 40 | }; // struct MBRData |
| 41 | |
| 42 | #endif |