/* gpt.c - Read GUID Partition Tables (GPT). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2005,2006,2007,2008 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/partition.h>
#include <grub/msdos_partition.h>
#include <grub/gpt_partition.h>
GRUB_MOD_LICENSE ("GPLv3+");
{
0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54
};
#ifdef GRUB_UTIL
static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
#endif
/* 512 << 7 = 65536 byte sectors. */
static grub_err_t
const grub_partition_t partition))
{
unsigned int i;
int last_offset = 0;
int sector_log = 0;
/* Read the protective MBR. */
return grub_errno;
/* Check if it is valid. */
/* Make sure the MBR is a protective MBR and not a normal MBR. */
/* Read the GPT header. */
{
return grub_errno;
break;
}
if (sector_log == MAX_SECTOR_LOG)
{
return grub_errno;
sizeof (grub_gpt_partition_type_empty)))
{
/* Calculate the first block and the size of the partition. */
return grub_errno;
}
if (last_offset == GRUB_DISK_SECTOR_SIZE)
{
last_offset = 0;
entries++;
}
}
return GRUB_ERR_NONE;
}
#ifdef GRUB_UTIL
static grub_err_t
{
unsigned i;
const grub_partition_t p);
const grub_partition_t p)
{
{
return 0;
}
/* If there's an embed region, it is in a dedicated partition. */
{
return 1;
}
return 0;
}
if (embed_type != GRUB_EMBED_PCBIOS)
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"GPT currently supports only PC-BIOS embedding");
if (err)
return err;
if (len == 0)
return grub_error (GRUB_ERR_FILE_NOT_FOUND,
"This GPT partition label has no BIOS Boot Partition;"
" embedding won't be possible!");
return grub_error (GRUB_ERR_OUT_OF_RANGE,
"Your BIOS Boot Partition is too small;"
" embedding won't be possible!");
if (!*sectors)
return grub_errno;
for (i = 0; i < *nsectors; i++)
return GRUB_ERR_NONE;
}
#endif
/* Partition map type. */
{
.name = "gpt",
#ifdef GRUB_UTIL
#endif
};
{
}
{
}