1 /* 2 * Copyright 2009, Michael Lotz, mmlr@mlotz.ch. All rights reserved. 3 * Copyright 2007-2013, Axel Dörfler, axeld@pinc-software.de. 4 * 5 * Distributed under the terms of the MIT License. 6 */ 7 #ifndef GPT_KNOWN_GUIDS_H 8 #define GPT_KNOWN_GUIDS_H 9 10 11 #include <ByteOrder.h> 12 13 #include <disk_device_types.h> 14 15 16 struct guid; 17 18 19 struct static_guid { 20 uint32 data1; 21 uint16 data2; 22 uint16 data3; 23 uint64 data4; 24 25 inline bool operator==(const guid& other) const; 26 inline operator guid_t() const; 27 } _PACKED; 28 29 30 inline bool 31 static_guid::operator==(const guid_t& other) const 32 { 33 return B_HOST_TO_LENDIAN_INT32(data1) == other.data1 34 && B_HOST_TO_LENDIAN_INT16(data2) == other.data2 35 && B_HOST_TO_LENDIAN_INT16(data3) == other.data3 36 && B_HOST_TO_BENDIAN_INT64(*(uint64*)&data4) == *(uint64*)other.data4; 37 // the last 8 bytes are in big-endian order 38 } 39 40 41 inline 42 static_guid::operator guid_t() const 43 { 44 guid_t guid; 45 guid.data1 = B_HOST_TO_LENDIAN_INT32(data1); 46 guid.data2 = B_HOST_TO_LENDIAN_INT16(data2); 47 guid.data3 = B_HOST_TO_LENDIAN_INT16(data3); 48 uint64 last = B_HOST_TO_BENDIAN_INT64(*(uint64*)&data4); 49 memcpy(guid.data4, &last, sizeof(uint64)); 50 51 return guid; 52 } 53 54 55 const static struct type_map { 56 static_guid guid; 57 const char* type; 58 } kTypeMap[] = { 59 // Core EFI partition types 60 {{0xC12A7328, 0xF81F, 0x11D2, 0xBA4B00A0C93EC93BLL}, "EFI system data"}, 61 {{0x21686148, 0x6449, 0x6E6F, 0x744E656564454649LL}, "BIOS boot data"}, 62 {{0x024DEE41, 0x33E7, 0x11D3, 0x9D690008C781F39FLL}, "MBR partition nest"}, 63 // Haiku partition 64 {{0x42465331, 0x3BA3, 0x10F1, 0x802A4861696B7521LL}, BFS_NAME}, 65 // Linux partitions 66 {{0x0FC63DAF, 0x8483, 0x4772, 0x8E793D69D8477DE4LL}, "Linux data"}, 67 {{0xE6D6D379, 0xF507, 0x44C2, 0xA23C238F2A3DF928LL}, "Linux data (LVM)"}, 68 {{0xA19D880F, 0x05FC, 0x4D3B, 0xA006743F0F84911ELL}, "Linux data (RAID)"}, 69 {{0x0657FD6D, 0xA4AB, 0x43C4, 0x84E50933C84B4F4FLL}, "Linux swap"}, 70 // Windows partitions 71 {{0xEBD0A0A2, 0xB9E5, 0x4433, 0x87C068B6B72699C7LL}, "Windows data"}, 72 // Apple partitions 73 {{0x426F6F74, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple boot"}, 74 {{0x48465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple data (HFS+)"}, 75 {{0x55465300, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple data (UFS)"}, 76 {{0x52414944, 0x0000, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID"}, 77 {{0x52414944, 0x5F4F, 0x11AA, 0xAA1100306543ECACLL}, "Apple RAID, offline"}, 78 // ChromeOS partitions 79 {{0xFE3A2A5D, 0x4F32, 0x41A7, 0xB725ACCC3285A309LL}, "ChromeOS kernel"}, 80 {{0x3CB8E202, 0x3B7E, 0x47DD, 0x8A3C7FF2A13CFCECLL}, "ChromeOS rootfs"}, 81 // BSD partitions 82 {{0x83BD6B9D, 0x7F41, 0x11DC, 0xBE0B001560B84F0FLL}, "FreeBSD boot"}, 83 {{0x516E7CB4, 0x6ECF, 0x11D6, 0x8FF800022D09712BLL}, "FreeBSD data"}, 84 {{0x516E7CB6, 0x6ECF, 0x11D6, 0x8FF800022D09712BLL}, "FreeBSD data (UFS)"}, 85 {{0x516E7CBA, 0x6ECF, 0x11D6, 0x8FF800022D09712BLL}, "FreeBSD data (ZFS)"}, 86 {{0x516E7CB5, 0x6ECF, 0x11D6, 0x8FF800022D09712BLL}, "FreeBSD swap"}, 87 {{0x85D5E45E, 0x237C, 0x11E1, 0xB4B3E89A8F7FC3A7LL}, "MidnightBSD boot"}, 88 {{0x85D5E45A, 0x237C, 0x11E1, 0xB4B3E89A8F7FC3A7LL}, "MidnightBSD data"}, 89 {{0x85D5E45B, 0x237C, 0x11E1, 0xB4B3E89A8F7FC3A7LL}, "MidnightBSD swap"}, 90 {{0x49F48D5A, 0xB10E, 0x11DC, 0xB99B0019D1879648LL}, "NetBSD data (ffs)"}, 91 {{0x49F48D82, 0xB10E, 0x11DC, 0xB99B0019D1879648LL}, "NetBSD data (lfs)"}, 92 {{0x49F48D32, 0xB10E, 0x11DC, 0xB99B0019D1879648LL}, "NetBSD swap"}, 93 {{0x824CC7A0, 0x36A8, 0x11E3, 0x890A952519AD3F61LL}, "OpenBSD data"}, 94 // Other 95 {{0xCEF5A9AD, 0x73BC, 0x4601, 0x89F3CDEEEEE321A1LL}, "QNX data"}, 96 {{0x6A898CC3, 0x1DD2, 0x11B2, 0x99A6080020736631LL}, "Solaris data (ZFS)"} 97 }; 98 99 100 #endif // GPT_KNOWN_GUIDS_H 101