| srs5694 | e7b4ff9 | 2009-08-18 13:16:10 -0400 | [diff] [blame^] | 1 | #include <stdint.h> |
| 2 | #include <unistd.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | #ifdef __APPLE__ |
| 6 | // Darwin (Mac OS) only: disk IOCTLs are different, and there is no lseek64 |
| 7 | #include <sys/disk.h> |
| 8 | #define lseek64 lseek |
| 9 | #else |
| 10 | |
| 11 | // Linux only.... |
| 12 | #include <linux/fs.h> |
| 13 | #endif |
| 14 | |
| 15 | #include <string> |
| 16 | |
| 17 | #ifndef __GPTSUPPORT |
| 18 | #define __GPTSUPPORT |
| 19 | |
| 20 | // Set this as a default |
| 21 | #define SECTOR_SIZE UINT32_C(512) |
| 22 | |
| 23 | using namespace std; |
| 24 | |
| 25 | // a GUID |
| 26 | struct GUIDData { |
| 27 | uint64_t data1; |
| 28 | uint64_t data2; |
| 29 | }; // struct GUIDData |
| 30 | |
| 31 | int GetNumber(int low, int high, int def, const char prompt[]); |
| 32 | char GetYN(void); |
| 33 | uint64_t GetLastSector(uint64_t low, uint64_t high, char prompt[]); |
| 34 | char* BytesToSI(uint64_t size, char theValue[]); |
| 35 | int GetBlockSize(int fd); |
| 36 | char* GUIDToStr(struct GUIDData theGUID, char* theString); |
| 37 | GUIDData GetGUID(void); |
| 38 | uint64_t PowerOf2(int value); |
| 39 | |
| 40 | uint64_t disksize(int fd, int* err); |
| 41 | |
| 42 | #endif |