aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-11-02 23:08:48 +0000
committerWarner Losh <imp@FreeBSD.org>2021-11-02 23:09:17 +0000
commitedfbbfd541ab9f7ba13b246d86bd0c36757ec660 (patch)
tree79b5ce6b6a0100b10b3c78cae05733dc582def0e
parente3ab141fda6a999d6fcdf050e07174199eea5557 (diff)
downloadsrc-edfbbfd541ab9f7ba13b246d86bd0c36757ec660.tar.gz
src-edfbbfd541ab9f7ba13b246d86bd0c36757ec660.zip
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
-rw-r--r--sys/geom/part/g_part_mbr.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c
index 750d417bba5d..d5d18e52456d 100644
--- a/sys/geom/part/g_part_mbr.c
+++ b/sys/geom/part/g_part_mbr.c
@@ -309,12 +309,23 @@ g_part_mbr_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
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 */