gpt_partition.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_GPT_PARTITION_HEADER
  19. #define GRUB_GPT_PARTITION_HEADER 1
  20. #include <grub/types.h>
  21. #include <grub/partition.h>
  22. #define GRUB_GPT_PARTITION_TYPE_EMPTY \
  23. { 0x0, 0x0, 0x0, \
  24. { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \
  25. }
  26. #define GRUB_GPT_PARTITION_TYPE_BIOS_BOOT \
  27. { grub_cpu_to_le32_compile_time (0x21686148), \
  28. grub_cpu_to_le16_compile_time (0x6449), \
  29. grub_cpu_to_le16_compile_time (0x6e6f), \
  30. { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } \
  31. }
  32. #define GRUB_GPT_PARTITION_TYPE_LDM \
  33. { grub_cpu_to_le32_compile_time (0x5808C8AAU),\
  34. grub_cpu_to_le16_compile_time (0x7E8F), \
  35. grub_cpu_to_le16_compile_time (0x42E0), \
  36. { 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \
  37. }
  38. struct grub_gpt_header
  39. {
  40. grub_uint8_t magic[8];
  41. grub_uint32_t version;
  42. grub_uint32_t headersize;
  43. grub_uint32_t crc32;
  44. grub_uint32_t unused1;
  45. grub_uint64_t primary;
  46. grub_uint64_t backup;
  47. grub_uint64_t start;
  48. grub_uint64_t end;
  49. grub_uint8_t guid[16];
  50. grub_uint64_t partitions;
  51. grub_uint32_t maxpart;
  52. grub_uint32_t partentry_size;
  53. grub_uint32_t partentry_crc32;
  54. } GRUB_PACKED;
  55. struct grub_gpt_partentry
  56. {
  57. grub_guid_t type;
  58. grub_guid_t guid;
  59. grub_uint64_t start;
  60. grub_uint64_t end;
  61. grub_uint64_t attrib;
  62. char name[72];
  63. };
  64. grub_err_t
  65. grub_gpt_partition_map_iterate (grub_disk_t disk,
  66. grub_partition_iterate_hook_t hook,
  67. void *hook_data);
  68. #endif /* ! GRUB_GPT_PARTITION_HEADER */