chain.c32, libcom32: Move gpt_part_dump() as disk_gpt_part_dump()
authorShao Miller <shao.miller@yrdsb.edu.on.ca>
Mon, 28 Jun 2010 10:07:04 +0000 (06:07 -0400)
committerShao Miller <shao.miller@yrdsb.edu.on.ca>
Sat, 10 Jul 2010 05:03:07 +0000 (01:03 -0400)
Moving portions of chain.c32 into libcom32.

Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
com32/include/syslinux/disk.h
com32/lib/syslinux/disk.c
com32/modules/chain.c

index a1d0aee..7c4e276 100644 (file)
@@ -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 */
index 02a1d59..ef579d9 100644 (file)
@@ -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);
+}
index 1134f9d..f69c9bd 100644 (file)
@@ -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;