[syslinux] [PATCH 13/23] com32/chain: use disk_guid for part_guid for 0th partition

Michal Soltys soltys at ziu.info
Mon Nov 5 16:32:47 PST 2012


Initial position of each itarator is whole disk, so this actually
matches.

Signed-off-by: Michal Soltys <soltys at ziu.info>
---
 com32/chain/chain.c    |   10 +++-------
 com32/chain/partiter.c |    1 +
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index f2f6719..97e1cf8 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -110,15 +110,11 @@ static int find_by_guid(const struct guid *gpt_guid,
 	    pi_del(&boot_part);
 	    continue;
 	}
-	/* Check for a matching GPT disk guid */
-	if (!memcmp(&boot_part->gpt.disk_guid, gpt_guid, sizeof(*gpt_guid))) {
-	    goto ok;
-	}
-	/* disk guid doesn't match, maybe partition guid will */
-	while (!pi_next(boot_part)) {
+	/* Check for a matching GPT disk/partition guid */
+	do {
 	    if (!memcmp(&boot_part->gpt.part_guid, gpt_guid, sizeof(*gpt_guid)))
 		goto ok;
-	}
+	} while (!pi_next(boot_part));
     }
     drive = -1;
 ok:
diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c
index 14e74de..0ebf62d 100644
--- a/com32/chain/partiter.c
+++ b/com32/chain/partiter.c
@@ -142,6 +142,7 @@ static int pi_gpt_ctor(struct part_iter *iter,
     iter->gpt.ulast = gpth->lba_last_usable;
 
     memcpy(&iter->gpt.disk_guid, &gpth->disk_guid, sizeof(struct guid));
+    memcpy(&iter->gpt.part_guid, &gpth->disk_guid, sizeof(struct guid));
 
     iter->type = typegpt;
     return 0;
-- 
1.7.10.4




More information about the Syslinux mailing list