Michal Soltys
2010-Jul-30 06:46 UTC
[syslinux] chain.c: fix v2 for public indexes in iterators (for master and disklib)
>From the earlier patches - that simple fix for indexes not counting non-datapartitions in gpt and mbr cases. Patches don't touch any other parts of the code at this stage - bigger stuff later for disklib as we agreed - but this is potentially useful right now. Michal Soltys (1): chain.c: fix public index value in mbr and gpt iterators
Michal Soltys
2010-Jul-30 06:46 UTC
[syslinux] [PATCH 1/1, disklib] chain.c: fix public index value in mbr and gpt iterators
mbr and gpt iterators skip empty / non-data partitions properly, but don't update publicly visible index. With this patch, such partitions are counted as well. Signed-off-by: Michal Soltys <soltys at ziu.info> --- com32/modules/chain.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 5078ed3..60e3abc 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -335,8 +335,8 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part) /* Update parameters to reflect this new partition. Re-use iterator */ part->lba_data = table[part->private.mbr_index].start_lba; - dprintf("Partition %d primary lba %u\n", part->index, part->lba_data); - part->index++; + dprintf("Partition %d primary lba %u\n", part->private.mbr_index, part->lba_data); + part->index = part->private.mbr_index + 1; part->record = table + part->private.mbr_index; return part; @@ -369,7 +369,7 @@ static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part) part->private.gpt.part_guid = &gpt_part->uid; part->private.gpt.part_label = gpt_part->name; /* Update our index */ - part->index++; + part->index = part->private.gpt.index + 1; #ifdef DEBUG disk_gpt_part_dump(gpt_part); #endif -- 1.6.3.1
Michal Soltys
2010-Jul-30 06:46 UTC
[syslinux] [PATCH 1/1, master] chain.c: fix public index value in mbr and gpt iterators
mbr and gpt iterators skip empty / non-data partitions properly, but don't update publicly visible index. With this patch, such partitions are counted as well. Signed-off-by: Michal Soltys <soltys at ziu.info> --- com32/modules/chain.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index 48a83d2..a5f6401 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -624,8 +624,8 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part) /* Update parameters to reflect this new partition. Re-use iterator */ part->lba_data = table[part->private.mbr_index].start_lba; - dprintf("Partition %d primary lba %u\n", part->index, part->lba_data); - part->index++; + dprintf("Partition %d primary lba %u\n", part->private.mbr_index, part->lba_data); + part->index = part->private.mbr_index + 1; part->record = table + part->private.mbr_index; return part; @@ -869,7 +869,7 @@ static struct disk_part_iter *next_gpt_part(struct disk_part_iter *part) part->private.gpt.part_guid = &gpt_part->uid; part->private.gpt.part_label = gpt_part->name; /* Update our index */ - part->index++; + part->index = part->private.gpt.index + 1; gpt_part_dump(gpt_part); /* In a GPT scheme, we re-use the iterator */ -- 1.6.3.1
Miller, Shao
2010-Jul-30 07:52 UTC
[syslinux] chain.c: fix v2 for public indexes in iterators (for master and disklib)
Thanks again, Michal! Matching what indices Linux uses is what I think H. Peter expressed as desired behaviour all along. - Shao
H. Peter Anvin
2010-Jul-30 20:24 UTC
[syslinux] chain.c: fix v2 for public indexes in iterators (for master and disklib)
On 07/30/2010 12:52 AM, Miller, Shao wrote:> Thanks again, Michal! Matching what indices Linux uses is what I think > H. Peter expressed as desired behaviour all along. - ShaoIndeed. I wonder if this is the problem Alec Moskvin is seeing. -hpa
Reasonably Related Threads
- PATCH/RFC chain.c: update iterator code, yank from chain.c, move both to separate directory
- [RFC/PATCH] New chainloading functionality
- [PATCH] chain.c: allocation fixes
- [PATCH] chain.c: gpt's index/private.index mismatch fix, cosmetic iterator changes
- chain.c32 (and partiter) updates v2