* grub-core/disk/lvm.c (grub_lvm_scan_device) [GRUB_UTIL]: Output more

diagnostic info.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-09-05 23:20:13 +02:00
parent d7ee3441eb
commit 294f324d89
2 changed files with 87 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2010-09-05 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/lvm.c (grub_lvm_scan_device) [GRUB_UTIL]: Output more
diagnostic info.
2010-09-05 Jo Shields <directhex@apebox.org>
* util/grub.d/30_os-prober.in: Add missing classes.

View File

@ -274,6 +274,10 @@ grub_lvm_scan_device (const char *name)
struct grub_lvm_vg *vg;
struct grub_lvm_pv *pv;
#ifdef GRUB_UTIL
grub_util_info ("scanning %s for LVM", name);
#endif
disk = grub_disk_open (name);
if (!disk)
return 0;
@ -294,7 +298,12 @@ grub_lvm_scan_device (const char *name)
/* Return if we didn't find a label. */
if (i == GRUB_LVM_LABEL_SCAN_SECTORS)
goto fail;
{
#ifdef GRUB_UTIL
grub_util_info ("no LVM signature found\n");
#endif
goto fail;
}
pvh = (struct grub_lvm_pv_header *) (buf + grub_le_to_cpu32(lh->offset_xl));
@ -318,6 +327,9 @@ grub_lvm_scan_device (const char *name)
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"we don't support multiple LVM data areas");
#ifdef GRUB_UTIL
grub_util_info ("we don't support multiple LVM data areas\n");
#endif
goto fail;
}
@ -344,6 +356,9 @@ grub_lvm_scan_device (const char *name)
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"unknown LVM metadata header");
#ifdef GRUB_UTIL
grub_util_info ("unknown LVM metadata header\n");
#endif
goto fail2;
}
@ -364,7 +379,12 @@ grub_lvm_scan_device (const char *name)
q++;
if (q == metadatabuf + mda_size)
goto fail2;
{
#ifdef GRUB_UTIL
grub_util_info ("error parsing metadata\n");
#endif
goto fail2;
}
vgname_len = q - p;
vgname = grub_malloc (vgname_len + 1);
@ -376,7 +396,12 @@ grub_lvm_scan_device (const char *name)
p = grub_strstr (q, "id = \"");
if (p == NULL)
goto fail3;
{
#ifdef GRUB_UTIL
grub_util_info ("couldn't find ID\n");
#endif
goto fail3;
}
p += sizeof ("id = \"") - 1;
grub_memcpy (vg_id, p, GRUB_LVM_ID_STRLEN);
vg_id[GRUB_LVM_ID_STRLEN] = '\0';
@ -399,7 +424,12 @@ grub_lvm_scan_device (const char *name)
vg->extent_size = grub_lvm_getvalue (&p, "extent_size = ");
if (p == NULL)
goto fail4;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown extent size\n");
#endif
goto fail4;
}
vg->lvs = NULL;
vg->pvs = NULL;
@ -439,11 +469,21 @@ grub_lvm_scan_device (const char *name)
pv->start = grub_lvm_getvalue (&p, "pe_start = ");
if (p == NULL)
goto pvs_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown pe_start\n");
#endif
goto pvs_fail;
}
p = grub_strchr (p, '}');
if (p == NULL)
goto pvs_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("error parsing pe_start\n");
#endif
goto pvs_fail;
}
p++;
pv->disk = NULL;
@ -500,7 +540,12 @@ grub_lvm_scan_device (const char *name)
lv->segment_count = grub_lvm_getvalue (&p, "segment_count = ");
if (p == NULL)
goto lvs_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown segment_count\n");
#endif
goto lvs_fail;
}
lv->segments = grub_malloc (sizeof (*seg) * lv->segment_count);
seg = lv->segments;
@ -510,14 +555,29 @@ grub_lvm_scan_device (const char *name)
p = grub_strstr (p, "segment");
if (p == NULL)
goto lvs_segment_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown segment\n");
#endif
goto lvs_segment_fail;
}
seg->start_extent = grub_lvm_getvalue (&p, "start_extent = ");
if (p == NULL)
goto lvs_segment_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown start_extent\n");
#endif
goto lvs_segment_fail;
}
seg->extent_count = grub_lvm_getvalue (&p, "extent_count = ");
if (p == NULL)
goto lvs_segment_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown extent_count\n");
#endif
goto lvs_segment_fail;
}
if (grub_lvm_checkvalue (&p, "type = ", "snapshot"))
{
@ -528,7 +588,12 @@ grub_lvm_scan_device (const char *name)
seg->stripe_count = grub_lvm_getvalue (&p, "stripe_count = ");
if (p == NULL)
goto lvs_segment_fail;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripe_count\n");
#endif
goto lvs_segment_fail;
}
lv->size += seg->extent_count * vg->extent_size;
@ -541,7 +606,12 @@ grub_lvm_scan_device (const char *name)
p = grub_strstr (p, "stripes = [");
if (p == NULL)
goto lvs_segment_fail2;
{
#ifdef GRUB_UTIL
grub_util_info ("unknown stripes\n");
#endif
goto lvs_segment_fail2;
}
p += sizeof("stripes = [") - 1;
for (j = 0; j < seg->stripe_count; j++)