git: e3ab141fda6a - main - gpart: Move GPT efimedia reporting to a separate routine

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 02 Nov 2021 23:09:40 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e3ab141fda6a999d6fcdf050e07174199eea5557

commit e3ab141fda6a999d6fcdf050e07174199eea5557
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-11-02 23:08:37 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-11-02 23:09:17 +0000

    gpart: Move GPT efimedia reporting to a separate routine
    
    Move the efimedia reporting to g_part_gpt_efimedia and use that from
    g_part_gpt_dumpconf to report it.
    
    Sponsored by:           Netflix
    Reviewed by:            mav
    Differential Revision:  https://reviews.freebsd.org/D32780
---
 sys/geom/part/g_part_gpt.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index 89a92977dff6..1f6d3dff249d 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -734,6 +734,15 @@ g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
 	return (0);
 }
 
+static void
+g_part_gpt_efimedia(struct g_part_gpt_entry *entry, struct sbuf *sb)
+{
+	sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index);
+	sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
+	sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start,
+	    (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+}
+
 static void
 g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
     struct sbuf *sb, const char *indent)
@@ -768,10 +777,7 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
 		sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
 		sbuf_cat(sb, "</rawuuid>\n");
 		sbuf_printf(sb, "%s<efimedia>", indent);
-		sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index);
-		sbuf_printf_uuid(sb, &entry->ent.ent_uuid);
-		sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start,
-		    (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1));
+		g_part_gpt_efimedia(entry, sb);
 		sbuf_cat(sb, "</efimedia>\n");
 	} else {
 		/* confxml: scheme information */