* Makefile.util.def: Add partmap/msdos.c to common library.
* include/grub/msdos_partition.h: Add GRUB_PC_PARTITION_TYPE_LDM * grub-core/disk/ldm.c: Check for existence of GRUB_PC_PARTITION_TYPE_LDM.
This commit is contained in:
parent
28d468d6f2
commit
b7b78edb1c
4 changed files with 49 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2013-02-25 Andrey Borzenkov <arvidjaar@gmail.com>
|
||||||
|
|
||||||
|
* Makefile.util.def: Add partmap/msdos.c to common library.
|
||||||
|
* include/grub/msdos_partition.h: Add GRUB_PC_PARTITION_TYPE_LDM
|
||||||
|
* grub-core/disk/ldm.c: Check for existence of
|
||||||
|
GRUB_PC_PARTITION_TYPE_LDM.
|
||||||
|
|
||||||
2013-02-25 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-02-25 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/normal/misc.c (grub_normal_print_device_info): Use KiB to display
|
* grub-core/normal/misc.c (grub_normal_print_device_info): Use KiB to display
|
||||||
|
|
|
@ -32,6 +32,7 @@ library = {
|
||||||
common = grub-core/disk/ldm.c;
|
common = grub-core/disk/ldm.c;
|
||||||
common = grub-core/disk/diskfilter.c;
|
common = grub-core/disk/diskfilter.c;
|
||||||
common = grub-core/partmap/gpt.c;
|
common = grub-core/partmap/gpt.c;
|
||||||
|
common = grub-core/partmap/msdos.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
library = {
|
library = {
|
||||||
|
@ -110,7 +111,6 @@ library = {
|
||||||
common = grub-core/partmap/acorn.c;
|
common = grub-core/partmap/acorn.c;
|
||||||
common = grub-core/partmap/amiga.c;
|
common = grub-core/partmap/amiga.c;
|
||||||
common = grub-core/partmap/apple.c;
|
common = grub-core/partmap/apple.c;
|
||||||
common = grub-core/partmap/msdos.c;
|
|
||||||
common = grub-core/partmap/sun.c;
|
common = grub-core/partmap/sun.c;
|
||||||
common = grub-core/partmap/plan.c;
|
common = grub-core/partmap/plan.c;
|
||||||
common = grub-core/partmap/dvh.c;
|
common = grub-core/partmap/dvh.c;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <grub/err.h>
|
#include <grub/err.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/diskfilter.h>
|
#include <grub/diskfilter.h>
|
||||||
|
#include <grub/msdos_partition.h>
|
||||||
#include <grub/gpt_partition.h>
|
#include <grub/gpt_partition.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
@ -103,6 +104,37 @@ read_int (grub_uint8_t *in, grub_size_t s)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
check_ldm_partition (grub_disk_t disk __attribute__ ((unused)), const grub_partition_t p, void *data)
|
||||||
|
{
|
||||||
|
int *has_ldm = data;
|
||||||
|
|
||||||
|
if (p->number >= 4)
|
||||||
|
return 1;
|
||||||
|
if (p->msdostype == GRUB_PC_PARTITION_TYPE_LDM)
|
||||||
|
{
|
||||||
|
*has_ldm = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
msdos_has_ldm_partition (grub_disk_t dsk)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
int has_ldm = 0;
|
||||||
|
|
||||||
|
err = grub_partition_msdos_iterate (dsk, check_ldm_partition, &has_ldm);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return has_ldm;
|
||||||
|
}
|
||||||
|
|
||||||
static const grub_gpt_part_type_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM;
|
static const grub_gpt_part_type_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM;
|
||||||
|
|
||||||
/* Helper for gpt_ldm_sector. */
|
/* Helper for gpt_ldm_sector. */
|
||||||
|
@ -760,17 +792,20 @@ grub_ldm_detect (grub_disk_t disk,
|
||||||
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int has_ldm = msdos_has_ldm_partition (disk);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
grub_disk_addr_t sector = LDM_LABEL_SECTOR;
|
grub_disk_addr_t sector = LDM_LABEL_SECTOR;
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
if (!has_ldm)
|
||||||
|
continue;
|
||||||
sector = LDM_LABEL_SECTOR;
|
sector = LDM_LABEL_SECTOR;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* LDM is never inside a partition. */
|
/* LDM is never inside a partition. */
|
||||||
if (disk->partition)
|
if (!has_ldm || disk->partition)
|
||||||
continue;
|
continue;
|
||||||
sector = grub_disk_get_size (disk);
|
sector = grub_disk_get_size (disk);
|
||||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||||
|
@ -871,6 +906,7 @@ int
|
||||||
grub_util_is_ldm (grub_disk_t disk)
|
grub_util_is_ldm (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int has_ldm = msdos_has_ldm_partition (disk);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
grub_disk_addr_t sector = LDM_LABEL_SECTOR;
|
grub_disk_addr_t sector = LDM_LABEL_SECTOR;
|
||||||
|
@ -880,11 +916,13 @@ grub_util_is_ldm (grub_disk_t disk)
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
if (!has_ldm)
|
||||||
|
continue;
|
||||||
sector = LDM_LABEL_SECTOR;
|
sector = LDM_LABEL_SECTOR;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
/* LDM is never inside a partition. */
|
/* LDM is never inside a partition. */
|
||||||
if (disk->partition)
|
if (!has_ldm || disk->partition)
|
||||||
continue;
|
continue;
|
||||||
sector = grub_disk_get_size (disk);
|
sector = grub_disk_get_size (disk);
|
||||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
#define GRUB_PC_PARTITION_TYPE_FAT16_LBA 0xe
|
||||||
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
#define GRUB_PC_PARTITION_TYPE_WIN95_EXTENDED 0xf
|
||||||
#define GRUB_PC_PARTITION_TYPE_PLAN9 0x39
|
#define GRUB_PC_PARTITION_TYPE_PLAN9 0x39
|
||||||
|
#define GRUB_PC_PARTITION_TYPE_LDM 0x42
|
||||||
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
#define GRUB_PC_PARTITION_TYPE_EZD 0x55
|
||||||
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
#define GRUB_PC_PARTITION_TYPE_MINIX 0x80
|
||||||
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
#define GRUB_PC_PARTITION_TYPE_LINUX_MINIX 0x81
|
||||||
|
|
Loading…
Reference in a new issue