[syslinux:disklib] chain.c32, libcom32: Move mbr_part_dump() as disk_dos_part_dump()

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


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

chain.c32, libcom32: Move mbr_part_dump() as disk_dos_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 |    1 +
 com32/lib/syslinux/disk.c     |   39 +++++++++++++++++++++++++++++++++++++++
 com32/modules/chain.c         |   41 ++++-------------------------------------
 3 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
index 79adae5..6e213c5 100644
--- a/com32/include/syslinux/disk.h
+++ b/com32/include/syslinux/disk.h
@@ -86,5 +86,6 @@ extern int disk_write_sector(const struct disk_info *const diskinfo,
 			     unsigned int lba, const void *data);
 extern int disk_write_verify_sector(const struct disk_info *const diskinfo,
 				    unsigned int lba, const void *buf);
+extern void disk_dos_part_dump(const struct disk_dos_part_entry *const part);
 
 #endif /* _SYSLINUX_DISK_H */
diff --git a/com32/lib/syslinux/disk.c b/com32/lib/syslinux/disk.c
index 3b23fef..b702207 100644
--- a/com32/lib/syslinux/disk.c
+++ b/com32/lib/syslinux/disk.c
@@ -33,6 +33,7 @@
  * Deal with disks and partitions
  */
 
+#include <dprintf.h>
 #include <stdlib.h>
 #include <string.h>
 #include <syslinux/disk.h>
@@ -284,3 +285,41 @@ int disk_write_verify_sector(const struct disk_info *const diskinfo,
     free(rb);
     return rv ? -1 : 0;
 }
+
+/**
+ * Dump info about a DOS partition entry
+ *
+ * @v part			The 16-byte partition entry to examine
+ */
+void disk_dos_part_dump(const struct disk_dos_part_entry *const part)
+{
+    (void)part;
+    dprintf("Partition status _____ : 0x%.2x\n"
+	    "Partition CHS start\n"
+	    "  Cylinder ___________ : 0x%.4x (%u)\n"
+	    "  Head _______________ : 0x%.2x (%u)\n"
+	    "  Sector _____________ : 0x%.2x (%u)\n"
+	    "Partition type _______ : 0x%.2x\n"
+	    "Partition CHS end\n"
+	    "  Cylinder ___________ : 0x%.4x (%u)\n"
+	    "  Head _______________ : 0x%.2x (%u)\n"
+	    "  Sector _____________ : 0x%.2x (%u)\n"
+	    "Partition LBA start __ : 0x%.8x (%u)\n"
+	    "Partition LBA count __ : 0x%.8x (%u)\n"
+	    "-------------------------------\n",
+	    part->active_flag,
+	    chs_cylinder(part->start),
+	    chs_cylinder(part->start),
+	    chs_head(part->start),
+	    chs_head(part->start),
+	    chs_sector(part->start),
+	    chs_sector(part->start),
+	    part->ostype,
+	    chs_cylinder(part->end),
+	    chs_cylinder(part->end),
+	    chs_head(part->end),
+	    chs_head(part->end),
+	    chs_sector(part->end),
+	    chs_sector(part->end),
+	    part->start_lba, part->start_lba, part->length, part->length);
+}
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index fd5cb66..04b1560 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -147,39 +147,6 @@ static inline void error(const char *msg)
 
 static struct disk_info diskinfo;
 
-static void mbr_part_dump(const struct disk_dos_part_entry *part)
-{
-    (void)part;
-    dprintf("Partition status _____ : 0x%.2x\n"
-	    "Partition CHS start\n"
-	    "  Cylinder ___________ : 0x%.4x (%u)\n"
-	    "  Head _______________ : 0x%.2x (%u)\n"
-	    "  Sector _____________ : 0x%.2x (%u)\n"
-	    "Partition type _______ : 0x%.2x\n"
-	    "Partition CHS end\n"
-	    "  Cylinder ___________ : 0x%.4x (%u)\n"
-	    "  Head _______________ : 0x%.2x (%u)\n"
-	    "  Sector _____________ : 0x%.2x (%u)\n"
-	    "Partition LBA start __ : 0x%.8x (%u)\n"
-	    "Partition LBA count __ : 0x%.8x (%u)\n"
-	    "-------------------------------\n",
-	    part->active_flag,
-	    chs_cylinder(part->start),
-	    chs_cylinder(part->start),
-	    chs_head(part->start),
-	    chs_head(part->start),
-	    chs_sector(part->start),
-	    chs_sector(part->start),
-	    part->ostype,
-	    chs_cylinder(part->end),
-	    chs_cylinder(part->end),
-	    chs_head(part->end),
-	    chs_head(part->end),
-	    chs_sector(part->end),
-	    chs_sector(part->end),
-	    part->start_lba, part->start_lba, part->length, part->length);
-}
-
 /* A DOS MBR */
 struct mbr {
     char code[440];
@@ -296,7 +263,7 @@ static struct disk_part_iter *next_ebr_part(struct disk_part_iter *part)
     }
     ebr_table = ((const struct mbr *)part->block)->table;
     dprintf("next_ebr_part:\n");
-    mbr_part_dump(ebr_table);
+    disk_dos_part_dump(ebr_table);
 
     /*
      * Sanity check entry: must not extend outside the
@@ -373,7 +340,7 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part)
 	return next_ebr_part(ebr_part);
     }
     dprintf("next_mbr_part:\n");
-    mbr_part_dump(table + part->private.mbr_index);
+    disk_dos_part_dump(table + part->private.mbr_index);
 
     /* Update parameters to reflect this new partition.  Re-use iterator */
     part->lba_data = table[part->private.mbr_index].start_lba;
@@ -1550,7 +1517,7 @@ int main(int argc, char *argv[])
 	    regs.esi.w[0] = 0x7be;
 
 	    dprintf("GPT handover:\n");
-	    mbr_part_dump(record);
+	    disk_dos_part_dump(record);
 	    gpt_part_dump((struct gpt_part *)(plen + 1));
 	} else if (cur_part->record) {
 	    /* MBR handover protocol */
@@ -1566,7 +1533,7 @@ int main(int argc, char *argv[])
 	    regs.esi.w[0] = 0x7be;
 
 	    dprintf("MBR handover:\n");
-	    mbr_part_dump(&handover_record);
+	    disk_dos_part_dump(&handover_record);
 	}
     }
 



More information about the Syslinux-commits mailing list