[syslinux:disklib] chain.c32, libcom32: Move gpt_part_dump() as disk_gpt_part_dump()

syslinux-bot for Shao Miller shao.miller at yrdsb.edu.on.ca
Sun Jul 25 17:33:20 PDT 2010


Commit-ID:  2cb2149a7c579ad8732053bd3391512daf253502
Gitweb:     http://syslinux.zytor.com/commit/2cb2149a7c579ad8732053bd3391512daf253502
Author:     Shao Miller <shao.miller at yrdsb.edu.on.ca>
AuthorDate: Mon, 28 Jun 2010 06:07:04 -0400
Committer:  Shao Miller <shao.miller at yrdsb.edu.on.ca>
CommitDate: Sat, 10 Jul 2010 01:03:07 -0400

chain.c32, libcom32: Move gpt_part_dump() as disk_gpt_part_dump()

Moving portions of chain.c32 into libcom32.

Signed-off-by: Shao Miller <shao.miller at yrdsb.edu.on.ca>


---
 com32/include/syslinux/disk.h |    2 ++
 com32/lib/syslinux/disk.c     |   27 +++++++++++++++++++++++++++
 com32/modules/chain.c         |   33 ++++++---------------------------
 3 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
index a1d0aee..7c4e276 100644
--- a/com32/include/syslinux/disk.h
+++ b/com32/include/syslinux/disk.h
@@ -123,5 +123,7 @@ extern int disk_write_verify_sector(const struct disk_info *const diskinfo,
 extern void disk_dos_part_dump(const struct disk_dos_part_entry *const part);
 extern void guid_to_str(char *buf, const struct guid *const id);
 extern int str_to_guid(const char *buf, struct guid *const id);
+extern void disk_gpt_part_dump(const struct disk_gpt_part_entry *const
+			       gpt_part);
 
 #endif /* _SYSLINUX_DISK_H */
diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c
index 02a1d59..ef579d9 100644
--- a/com32/lib/syslinux/disk.c
+++ b/com32/lib/syslinux/disk.c
@@ -440,3 +440,30 @@ int str_to_guid(const char *buf, struct guid *const id)
     }
     return 0;
 }
+
+/**
+ * Display GPT partition details.
+ *
+ * @v gpt_part			The GPT partition entry to display
+ */
+void disk_gpt_part_dump(const struct disk_gpt_part_entry *const gpt_part)
+{
+    unsigned int i;
+    char guid_text[37];
+
+    dprintf("----------------------------------\n"
+	    "GPT part. LBA first __ : 0x%.16llx\n"
+	    "GPT part. LBA last ___ : 0x%.16llx\n"
+	    "GPT part. attribs ____ : 0x%.16llx\n"
+	    "GPT part. name _______ : '",
+	    gpt_part->lba_first, gpt_part->lba_last, gpt_part->attribs);
+    for (i = 0; i < sizeof(gpt_part->name); i++) {
+	if (gpt_part->name[i])
+	    dprintf("%c", gpt_part->name[i]);
+    }
+    dprintf("'");
+    guid_to_str(guid_text, &gpt_part->type);
+    dprintf("GPT part. type GUID __ : {%s}\n", guid_text);
+    guid_to_str(guid_text, &gpt_part->uid);
+    dprintf("GPT part. unique ID __ : {%s}\n", guid_text);
+}
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 1134f9d..f69c9bd 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -348,31 +348,6 @@ err_alloc:
     return NULL;
 }
 
-static void gpt_part_dump(const struct disk_gpt_part_entry *gpt_part)
-{
-#ifdef DEBUG
-    unsigned int i;
-    char guid_text[37];
-
-    dprintf("----------------------------------\n"
-	    "GPT part. LBA first __ : 0x%.16llx\n"
-	    "GPT part. LBA last ___ : 0x%.16llx\n"
-	    "GPT part. attribs ____ : 0x%.16llx\n"
-	    "GPT part. name _______ : '",
-	    gpt_part->lba_first, gpt_part->lba_last, gpt_part->attribs);
-    for (i = 0; i < sizeof(gpt_part->name); i++) {
-	if (gpt_part->name[i])
-	    dprintf("%c", gpt_part->name[i]);
-    }
-    dprintf("'");
-    guid_to_str(guid_text, &gpt_part->type);
-    dprintf("GPT part. type GUID __ : {%s}\n", guid_text);
-    guid_to_str(guid_text, &gpt_part->uid);
-    dprintf("GPT part. unique ID __ : {%s}\n", guid_text);
-#endif
-    (void)gpt_part;
-}
-
 /* A GPT header */
 struct gpt {
     char sig[8];
@@ -457,7 +432,9 @@ static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part)
     part->private.gpt.part_label = gpt_part->name;
     /* Update our index */
     part->index++;
-    gpt_part_dump(gpt_part);
+#ifdef DEBUG
+    disk_gpt_part_dump(gpt_part);
+#endif
 
     /* In a GPT scheme, we re-use the iterator */
     return part;
@@ -1387,7 +1364,9 @@ int main(int argc, char *argv[])
 
 	    dprintf("GPT handover:\n");
 	    disk_dos_part_dump(record);
-	    gpt_part_dump((struct disk_gpt_part_entry *)(plen + 1));
+#ifdef DEBUG
+	    disk_gpt_part_dump((struct disk_gpt_part_entry *)(plen + 1));
+#endif
 	} else if (cur_part->record) {
 	    /* MBR handover protocol */
 	    static struct disk_dos_part_entry handover_record;



More information about the Syslinux-commits mailing list