gpt.h revision 44bc9120699af80bb18366ca474cb2c618608ca9
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * GRUB -- GRand Unified Bootloader
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Copyright (C) 2002,2005,2006 Free Software Foundation, Inc.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This program is free software; you can redistribute it and/or modify
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * it under the terms of the GNU General Public License as published by
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the Free Software Foundation; either version 2 of the License, or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * (at your option) any later version.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This program is distributed in the hope that it will be useful,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * but WITHOUT ANY WARRANTY; without even the implied warranty of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * GNU General Public License for more details.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You should have received a copy of the GNU General Public License
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * along with this program; if not, write to the Free Software
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#ifndef _GPT_H
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define _GPT_H
7f667e74610492ddbce8ce60f52ece95d2401949jose borrego
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef signed char grub_int8_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef signed short grub_int16_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef signed int grub_int32_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef signed long long int grub_int64_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef unsigned char grub_uint8_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef unsigned short grub_uint16_t;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Browntypedef unsigned int grub_uint32_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwtypedef unsigned long long int grub_uint64_t;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwstruct grub_gpt_header
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
6d57f8333dfc689618aaf2efe76a8066de053841Alan Wright grub_uint64_t magic;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint32_t version;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint32_t headersize;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint32_t crc32;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint32_t unused1;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint64_t primary;
6d57f8333dfc689618aaf2efe76a8066de053841Alan Wright grub_uint64_t backup;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown grub_uint64_t start;
6d57f8333dfc689618aaf2efe76a8066de053841Alan Wright grub_uint64_t end;
6d57f8333dfc689618aaf2efe76a8066de053841Alan Wright grub_uint8_t guid[16];
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint64_t partitions;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown grub_uint32_t maxpart;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown grub_uint32_t partentry_size;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint32_t partentry_crc32;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States} __attribute__ ((packed));
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United Statesstruct grub_gpt_partentry
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States{
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint64_t type1;
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States grub_uint64_t type2;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw grub_uint8_t guid[16];
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw grub_uint64_t start;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw grub_uint64_t end;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw grub_uint8_t attrib;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw char name[72];
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw} __attribute__ ((packed));
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define GPT_HEADER_MAGIC 0x5452415020494645ULL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define GPT_ENTRY_SECTOR(size,entry) \
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ((((entry) * (size) + 1) & ~(SECTOR_SIZE - 1)) >> SECTOR_BITS)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define GPT_ENTRY_INDEX(size,entry) \
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ((((entry) * (size) + 1) & (SECTOR_SIZE - 1)) - 1)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _GPT_H */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw