[syslinux:disklib] chain.c32, libcom32: Move struct gpt_part as disk_gpt_part_entry

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


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

chain.c32, libcom32: Move struct gpt_part as disk_gpt_part_entry

Moving portions of chain.c32 into libcom32.

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


---
 com32/include/syslinux/disk.h |   10 ++++++++++
 com32/modules/chain.c         |   27 +++++++++------------------
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/com32/include/syslinux/disk.h b/com32/include/syslinux/disk.h
index af9bf7b..108a568 100644
--- a/com32/include/syslinux/disk.h
+++ b/com32/include/syslinux/disk.h
@@ -115,6 +115,16 @@ static const char guid_le_walk_map[] = {
     1, 1, 1, 1, 1, 1
 };
 
+/* A GPT partition */
+struct disk_gpt_part_entry {
+    struct guid type;
+    struct guid uid;
+    uint64_t lba_first;
+    uint64_t lba_last;
+    uint64_t attribs;
+    char name[72];
+} __attribute__ ((packed));
+
 extern int disk_int13_retry(const com32sys_t * inreg, com32sys_t * outreg);
 extern int disk_get_params(int disk, struct disk_info *const diskinfo);
 extern void *disk_read_sectors(const struct disk_info *const diskinfo,
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 1b41ba2..4f198e5 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -438,17 +438,7 @@ static int str_to_guid(const char *buf, struct guid *id)
     return 0;
 }
 
-/* A GPT partition */
-struct gpt_part {
-    struct guid type;
-    struct guid uid;
-    uint64_t lba_first;
-    uint64_t lba_last;
-    uint64_t attribs;
-    char name[72];
-} __attribute__ ((packed));
-
-static void gpt_part_dump(const struct gpt_part *gpt_part)
+static void gpt_part_dump(const struct disk_gpt_part_entry *gpt_part)
 {
 #ifdef DEBUG
     unsigned int i;
@@ -537,13 +527,13 @@ static void gpt_dump(const struct gpt *gpt)
 
 static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part)
 {
-    const struct gpt_part *gpt_part = NULL;
+    const struct disk_gpt_part_entry *gpt_part = NULL;
 
     while (++part->private.gpt.index < part->private.gpt.parts) {
 	gpt_part =
-	    (const struct gpt_part *)(part->block +
-				      (part->private.gpt.index *
-				       part->private.gpt.size));
+	    (const struct disk_gpt_part_entry *)(part->block +
+						 (part->private.gpt.index *
+						  part->private.gpt.size));
 	if (!gpt_part->lba_first)
 	    continue;
 	break;
@@ -723,7 +713,7 @@ static int find_by_label(const char *label, struct disk_part_iter **boot_part)
 	}
 	/* Check for a matching partition */
 	while (boot_part[0]) {
-	    char gpt_label[sizeof(((struct gpt_part *) NULL)->name)];
+	    char gpt_label[sizeof(((struct disk_gpt_part_entry *) NULL)->name)];
 	    const char *gpt_label_scanner =
 		boot_part[0]->private.gpt.part_label;
 	    int j = 0;
@@ -1440,7 +1430,8 @@ int main(int argc, char *argv[])
 	    /* Do GPT hand-over, if applicable (as per syslinux/doc/gpt.txt) */
 	    struct disk_dos_part_entry *record;
 	    /* Look at the GPT partition */
-	    const struct gpt_part *gp = (const struct gpt_part *)
+	    const struct disk_gpt_part_entry *gp =
+		(const struct disk_gpt_part_entry *)
 		(cur_part->block +
 		 (cur_part->private.gpt.size * cur_part->private.gpt.index));
 	    /* Note the partition length */
@@ -1486,7 +1477,7 @@ int main(int argc, char *argv[])
 
 	    dprintf("GPT handover:\n");
 	    disk_dos_part_dump(record);
-	    gpt_part_dump((struct gpt_part *)(plen + 1));
+	    gpt_part_dump((struct disk_gpt_part_entry *)(plen + 1));
 	} else if (cur_part->record) {
 	    /* MBR handover protocol */
 	    static struct disk_dos_part_entry handover_record;



More information about the Syslinux-commits mailing list