/* apple.c - Read macintosh partition tables. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2005,2006,2007,2008,2009 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>
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_apple_header
{
/* The magic number to identify the partition map, it should have
the value `0x4552'. */
};
struct grub_apple_part
{
/* The magic number to identify this as a partition, it should have
the value `0x504D'. */
/* Reserved. */
/* The size of the partition map in blocks. */
/* The first physical block of the partition. */
/* The amount of blocks. */
/* The partition name. */
/* The partition type. */
/* The first datablock of the partition. */
/* The amount datablocks. */
/* The status of the partition. (???) */
/* The first block on which the bootcode can be found. */
/* The size of the bootcode in bytes. */
/* The load address of the bootcode. */
/* Reserved. */
/* The entry point of the bootcode. */
/* Reserved. */
/* A checksum of the bootcode. */
/* The processor type. */
/* Padding. */
};
static grub_err_t
const grub_partition_t partition))
{
unsigned pos;
return grub_errno;
{
grub_dprintf ("partition",
"bad magic (found 0x%x; wanted 0x%x\n",
goto fail;
}
do
{
sizeof (struct grub_apple_part), &apart))
return grub_errno;
{
grub_dprintf ("partition",
"partition %d: bad magic (found 0x%x; wanted 0x%x\n",
break;
}
if (partnum == 0)
grub_dprintf ("partition",
"partition %d: name %s, type %s, start 0x%x, len 0x%x\n",
return grub_errno;
partno++;
}
if (partno != 0)
return 0;
fail:
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Apple partition map not found");
}
/* Partition map type. */
{
.name = "apple",
};
{
}
{
}