[syslinux:disklib] chain.c32, libcom32: Move gpt_dump() as disk_gpt_header_dump()

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


Commit-ID:  f4f4e91cc75d6f5e9b127c34b7f1829c36518455
Gitweb:     http://syslinux.zytor.com/commit/f4f4e91cc75d6f5e9b127c34b7f1829c36518455
Author:     Shao Miller <shao.miller at yrdsb.edu.on.ca>
AuthorDate: Mon, 28 Jun 2010 06:21:21 -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_dump() as disk_gpt_header_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 |    1 +
 com32/lib/syslinux/disk.c     |   38 ++++++++++++++++++++++++++++++++++++++
 com32/modules/chain.c         |   39 ++-------------------------------------
 3 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
index 37641d0..ff80532 100644
--- a/com32/include/syslinux/disk.h
+++ b/com32/include/syslinux/disk.h
@@ -152,5 +152,6 @@ 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);
+extern void disk_gpt_header_dump(const struct disk_gpt_header *const gpt);
 
 #endif /* _SYSLINUX_DISK_H */
diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c
index ef579d9..678e4bd 100644
--- a/com32/lib/syslinux/disk.c
+++ b/com32/lib/syslinux/disk.c
@@ -467,3 +467,41 @@ void disk_gpt_part_dump(const struct disk_gpt_part_entry *const gpt_part)
     guid_to_str(guid_text, &gpt_part->uid);
     dprintf("GPT part. unique ID __ : {%s}\n", guid_text);
 }
+
+/**
+ * Display GPT header details.
+ *
+ * @v gpt			The GPT header to display
+ */
+void disk_gpt_header_dump(const struct disk_gpt_header *const gpt)
+{
+    char guid_text[37];
+
+    printf("GPT sig ______________ : '%8.8s'\n"
+	   "GPT major revision ___ : 0x%.4x\n"
+	   "GPT minor revision ___ : 0x%.4x\n"
+	   "GPT header size ______ : 0x%.8x\n"
+	   "GPT header checksum __ : 0x%.8x\n"
+	   "GPT reserved _________ : '%4.4s'\n"
+	   "GPT LBA current ______ : 0x%.16llx\n"
+	   "GPT LBA alternative __ : 0x%.16llx\n"
+	   "GPT LBA first usable _ : 0x%.16llx\n"
+	   "GPT LBA last usable __ : 0x%.16llx\n"
+	   "GPT LBA part. table __ : 0x%.16llx\n"
+	   "GPT partition count __ : 0x%.8x\n"
+	   "GPT partition size ___ : 0x%.8x\n"
+	   "GPT part. table chksum : 0x%.8x\n",
+	   gpt->sig,
+	   gpt->rev.fields.major,
+	   gpt->rev.fields.minor,
+	   gpt->hdr_size,
+	   gpt->chksum,
+	   gpt->reserved1,
+	   gpt->lba_cur,
+	   gpt->lba_alt,
+	   gpt->lba_first_usable,
+	   gpt->lba_last_usable,
+	   gpt->lba_table, gpt->part_count, gpt->part_size, gpt->table_chksum);
+    guid_to_str(guid_text, &gpt->disk_guid);
+    printf("GPT disk GUID ________ : {%s}\n", guid_text);
+}
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index a703ea0..5078ed3 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -348,41 +348,6 @@ err_alloc:
     return NULL;
 }
 
-#if DEBUG
-static void gpt_dump(const struct disk_gpt_header *gpt)
-{
-    char guid_text[37];
-
-    printf("GPT sig ______________ : '%8.8s'\n"
-	   "GPT major revision ___ : 0x%.4x\n"
-	   "GPT minor revision ___ : 0x%.4x\n"
-	   "GPT header size ______ : 0x%.8x\n"
-	   "GPT header checksum __ : 0x%.8x\n"
-	   "GPT reserved _________ : '%4.4s'\n"
-	   "GPT LBA current ______ : 0x%.16llx\n"
-	   "GPT LBA alternative __ : 0x%.16llx\n"
-	   "GPT LBA first usable _ : 0x%.16llx\n"
-	   "GPT LBA last usable __ : 0x%.16llx\n"
-	   "GPT LBA part. table __ : 0x%.16llx\n"
-	   "GPT partition count __ : 0x%.8x\n"
-	   "GPT partition size ___ : 0x%.8x\n"
-	   "GPT part. table chksum : 0x%.8x\n",
-	   gpt->sig,
-	   gpt->rev.fields.major,
-	   gpt->rev.fields.minor,
-	   gpt->hdr_size,
-	   gpt->chksum,
-	   gpt->reserved1,
-	   gpt->lba_cur,
-	   gpt->lba_alt,
-	   gpt->lba_first_usable,
-	   gpt->lba_last_usable,
-	   gpt->lba_table, gpt->part_count, gpt->part_size, gpt->table_chksum);
-    guid_to_str(guid_text, &gpt->disk_guid);
-    printf("GPT disk GUID ________ : {%s}\n", guid_text);
-}
-#endif
-
 static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part)
 {
     const struct disk_gpt_part_entry *gpt_part = NULL;
@@ -459,7 +424,7 @@ static struct disk_part_iter *get_first_partition(struct disk_part_iter *part)
 	/* TODO: Check checksum.  Possibly try alternative GPT */
 #if DEBUG
 	puts("Looks like a GPT disk.");
-	gpt_dump(gpt_candidate);
+	disk_gpt_header_dump(gpt_candidate);
 #endif
 	/* TODO: Check table checksum (maybe) */
 	/* Note relevant GPT details */
@@ -525,7 +490,7 @@ static int find_by_guid(const struct guid *gpt_guid,
 	    continue;
 	}
 #if DEBUG
-	gpt_dump(header);
+	disk_gpt_header_dump(header);
 #endif
 	is_me = !memcmp(&header->disk_guid, &gpt_guid, sizeof(*gpt_guid));
 	free(header);



More information about the Syslinux-commits mailing list