gpart: Move MBR efimedia reporting to a separate routine

Move the efimedia reporting to g_part_mbr_efimedia and use that from
g_part_mbr_dumpconf to report it.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D32781
This commit is contained in:
Warner Losh 2021-11-02 17:08:48 -06:00
parent e3ab141fda
commit edfbbfd541

View file

@ -308,13 +308,24 @@ g_part_mbr_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
return (0);
}
static void
g_part_mbr_efimedia(struct g_part_mbr_table *table, struct g_part_mbr_entry *entry,
struct sbuf *sb)
{
uint32_t dsn;
dsn = le32dec(table->mbr + DOSDSNOFF);
sbuf_printf(sb, "HD(%d,MBR,%#08x,%#jx,%#jx)",
entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start,
(intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
}
static void
g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseentry,
struct sbuf *sb, const char *indent)
{
struct g_part_mbr_entry *entry;
struct g_part_mbr_table *table;
uint32_t dsn;
table = (struct g_part_mbr_table *)basetable;
entry = (struct g_part_mbr_entry *)baseentry;
@ -327,10 +338,8 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseent
entry->ent.dp_typ);
if (entry->ent.dp_flag & 0x80)
sbuf_printf(sb, "%s<attrib>active</attrib>\n", indent);
dsn = le32dec(table->mbr + DOSDSNOFF);
sbuf_printf(sb, "%s<efimedia>HD(%d,MBR,%#08x,%#jx,%#jx)", indent,
entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start,
(intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
sbuf_printf(sb, "%s<efimedia>", indent);
g_part_mbr_efimedia(table, entry, sb);
sbuf_cat(sb, "</efimedia>\n");
} else {
/* confxml: scheme information */