merge mainline into emu-mod

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-07 03:06:33 +01:00
commit 19a9fb834b
459 changed files with 26481 additions and 7640 deletions

View file

@ -85,7 +85,7 @@ acorn_partition_map_find (grub_disk_t disk, struct linux_part *m,
fail:
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Linux/ADFS partition map not found.");
"Linux/ADFS partition map not found");
}
@ -175,14 +175,7 @@ fail:
static char *
acorn_partition_map_get_name (const grub_partition_t p)
{
char *name;
name = grub_malloc (13);
if (! name)
return 0;
grub_sprintf (name, "%d", p->index + 1);
return name;
return grub_xasprintf ("%d", p->index + 1);
}

View file

@ -102,7 +102,7 @@ amiga_partition_map_iterate (grub_disk_t disk,
if (next == -1)
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Amiga partition map not found.");
"Amiga partition map not found");
/* The end of the partition list is marked using "-1". */
while (next != -1)
@ -184,14 +184,7 @@ amiga_partition_map_probe (grub_disk_t disk, const char *str)
static char *
amiga_partition_map_get_name (const grub_partition_t p)
{
char *name;
name = grub_malloc (13);
if (! name)
return 0;
grub_sprintf (name, "%d", p->index + 1);
return name;
return grub_xasprintf ("%d", p->index + 1);
}

View file

@ -1,7 +1,7 @@
/* apple.c - Read macintosh partition tables. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -176,7 +176,7 @@ apple_partition_map_iterate (grub_disk_t disk,
fail:
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"Apple partition map not found.");
"Apple partition map not found");
}
@ -227,14 +227,7 @@ apple_partition_map_probe (grub_disk_t disk, const char *str)
static char *
apple_partition_map_get_name (const grub_partition_t p)
{
char *name;
name = grub_malloc (13);
if (! name)
return 0;
grub_sprintf (name, "%d", p->index + 1);
return name;
return grub_xasprintf ("%d", p->index + 1);
}

View file

@ -162,14 +162,7 @@ gpt_partition_map_probe (grub_disk_t disk, const char *str)
static char *
gpt_partition_map_get_name (const grub_partition_t p)
{
char *name;
name = grub_malloc (13);
if (! name)
return 0;
grub_sprintf (name, "%d", p->index + 1);
return name;
return grub_xasprintf ("%d", p->index + 1);
}

View file

@ -300,21 +300,15 @@ pc_partition_map_probe (grub_disk_t disk, const char *str)
static char *
pc_partition_map_get_name (const grub_partition_t p)
{
char *name;
struct grub_msdos_partition *pcdata = p->data;
name = grub_malloc (13);
if (! name)
return 0;
if (pcdata->bsd_part < 0)
grub_sprintf (name, "%d", pcdata->dos_part + 1);
return grub_xasprintf ("%d", pcdata->dos_part + 1);
else if (pcdata->dos_part < 0)
grub_sprintf (name, "%c", pcdata->bsd_part + 'a');
return grub_xasprintf ("%c", pcdata->bsd_part + 'a');
else
grub_sprintf (name, "%d,%c", pcdata->dos_part + 1, pcdata->bsd_part + 'a');
return name;
return grub_xasprintf ("%d,%c", pcdata->dos_part + 1,
pcdata->bsd_part + 'a');
}

View file

@ -91,6 +91,7 @@ sun_partition_map_iterate (grub_disk_t disk,
struct grub_disk raw;
struct grub_sun_block block;
int partnum;
grub_err_t err;
raw = *disk;
raw.partition = 0;
@ -100,36 +101,47 @@ sun_partition_map_iterate (grub_disk_t disk,
return grub_errno;
p->partmap = &grub_sun_partition_map;
if (grub_disk_read (&raw, 0, 0, sizeof (struct grub_sun_block),
&block) == GRUB_ERR_NONE)
err = grub_disk_read (&raw, 0, 0, sizeof (struct grub_sun_block),
&block);
if (err)
{
if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.magic))
grub_error (GRUB_ERR_BAD_PART_TABLE, "not a sun partition table");
grub_free (p);
return err;
}
if (! grub_sun_is_valid (&block))
grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
if (GRUB_PARTMAP_SUN_MAGIC != grub_be_to_cpu16 (block.magic))
{
grub_free (p);
return grub_error (GRUB_ERR_BAD_PART_TABLE,
"not a sun partition table");
}
/* Maybe another error value would be better, because partition
table _is_ recognized but invalid. */
for (partnum = 0; partnum < GRUB_PARTMAP_SUN_MAX_PARTS; partnum++)
if (! grub_sun_is_valid (&block))
{
grub_free (p);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid checksum");
}
/* Maybe another error value would be better, because partition
table _is_ recognized but invalid. */
for (partnum = 0; partnum < GRUB_PARTMAP_SUN_MAX_PARTS; partnum++)
{
struct grub_sun_partition_descriptor *desc;
if (block.infos[partnum].id == 0
|| block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
continue;
desc = &block.partitions[partnum];
p->start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder)
* grub_be_to_cpu16 (block.ntrks)
* grub_be_to_cpu16 (block.nsect));
p->len = grub_be_to_cpu32 (desc->num_sectors);
p->index = partnum;
if (p->len)
{
struct grub_sun_partition_descriptor *desc;
if (block.infos[partnum].id == 0
|| block.infos[partnum].id == GRUB_PARTMAP_SUN_WHOLE_DISK_ID)
continue;
desc = &block.partitions[partnum];
p->start = ((grub_uint64_t) grub_be_to_cpu32 (desc->start_cylinder)
* grub_be_to_cpu16 (block.ntrks)
* grub_be_to_cpu16 (block.nsect));
p->len = grub_be_to_cpu32 (desc->num_sectors);
p->index = partnum;
if (p->len)
{
if (hook (disk, p))
partnum = GRUB_PARTMAP_SUN_MAX_PARTS;
}
if (hook (disk, p))
partnum = GRUB_PARTMAP_SUN_MAX_PARTS;
}
}
@ -184,13 +196,7 @@ sun_partition_map_probe (grub_disk_t disk, const char *str)
static char *
sun_partition_map_get_name (const grub_partition_t p)
{
char *name;
name = grub_malloc (13);
if (name)
grub_sprintf (name, "%d", p->index + 1);
return name;
return grub_xasprintf ("%d", p->index + 1);
}
/* Partition map type. */