aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Soltys <soltys@ziu.info>2013-02-14 16:51:46 +0100
committerMichal Soltys <soltys@ziu.info>2013-02-14 16:53:05 +0100
commitb5849a4d28bec1616ac4d2aa67b4ca5b3de55144 (patch)
treebd550a0e89c42a80791a52c4ec71f3f941645919
parentd9976c5f4230aa0bcc6f6572091bd2732bf35db9 (diff)
downloadsyslinux-b5849a4d28bec1616ac4d2aa67b4ca5b3de55144.tar.gz
syslinux-b5849a4d28bec1616ac4d2aa67b4ca5b3de55144.tar.xz
syslinux-b5849a4d28bec1616ac4d2aa67b4ca5b3de55144.zip
com32/chain: index -1 partiter adjustment
Currently, the only situation when index could be set to -1 was empty logical partition (with stepall flag active). To keep things consistent (and with index0 already providing "full" info), adjust the partiter to also set -1 on empty main partition. This change also allows simple index check to see whether we're are at the empty partition or not, without digging into disk_dos_part_entry data and retesting ostype field. We rely on it now in manglepe_hide(). Also some retab! changes in partiter.h and one variable rename. Signed-off-by: Michal Soltys <soltys@ziu.info>
-rw-r--r--com32/chain/mangle.c4
-rw-r--r--com32/chain/partiter.c6
-rw-r--r--com32/chain/partiter.h16
3 files changed, 12 insertions, 14 deletions
diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c
index 391554b2..215ca410 100644
--- a/com32/chain/mangle.c
+++ b/com32/chain/mangle.c
@@ -527,7 +527,6 @@ int manglepe_hide(struct part_iter *miter)
{
int wb = 0, werr = 0;
struct part_iter *iter = NULL;
- struct disk_dos_part_entry *dp;
int ridx;
if (!(opt.hide & HIDE_ON))
@@ -549,8 +548,7 @@ int manglepe_hide(struct part_iter *miter)
if (!(opt.hide & HIDE_EXT) && ridx > 3)
break; /* skip when we're constrained to pri only */
- dp = (struct disk_dos_part_entry *)iter->record;
- if (dp->ostype)
+ if (iter->index != -1)
wb |= fliphide(iter, miter);
/*
diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c
index 2e03fb55..0c11457d 100644
--- a/com32/chain/partiter.c
+++ b/com32/chain/partiter.c
@@ -371,7 +371,7 @@ static int dos_next_ebr(struct part_iter *iter, uint32_t *lba,
}
if (!dp[0].ostype)
- iter->dos.skipcnt++;
+ iter->dos.logskipcnt++;
if (dp[0].ostype || (iter->flags & PIF_STEPALL)) {
*lba = iter->dos.cebr_lba + dp[0].start_lba;
@@ -471,10 +471,10 @@ static int pi_dos_next(struct part_iter *iter)
* non-PIF_STEPALL iterators
*/
- if (iter->index0 >= 4 && !dos_part->ostype)
+ if (!dos_part->ostype)
iter->index = -1;
else
- iter->index = iter->index0 - iter->dos.skipcnt + 1;
+ iter->index = iter->index0 + 1 - iter->dos.logskipcnt;
iter->start_lba = start_lba;
iter->length = dos_part->length;
iter->record = (char *)dos_part;
diff --git a/com32/chain/partiter.h b/com32/chain/partiter.h
index 4004ef9e..31df785a 100644
--- a/com32/chain/partiter.h
+++ b/com32/chain/partiter.h
@@ -73,17 +73,17 @@ struct part_iter {
struct disk_info di;
union {
struct {
- uint32_t disk_sig; /* 32bit disk signature as stored in MBR */
+ uint32_t disk_sig; /* 32bit disk signature as stored in MBR */
- uint32_t bebr_lba; /* absolute lba of base extended partition */
- uint32_t bebr_siz; /* size of base extended partition */
+ uint32_t bebr_lba; /* absolute lba of base extended partition */
+ uint32_t bebr_siz; /* size of base extended partition */
- uint32_t cebr_lba; /* absolute lba of curr ext. partition */
- uint32_t nebr_lba; /* absolute lba of next ext. partition */
- uint32_t nebr_siz; /* size of next ext. partition */
+ uint32_t cebr_lba; /* absolute lba of curr ext. partition */
+ uint32_t nebr_lba; /* absolute lba of next ext. partition */
+ uint32_t nebr_siz; /* size of next ext. partition */
- int bebr_index0; /* index of (0-3) of base ext. part., -1 if not present in MBR */
- int skipcnt; /* how many logical holes were skipped */
+ int bebr_index0; /* index of (0-3) of base ext. part., -1 if not present in MBR */
+ int logskipcnt; /* how many logical holes were skipped */
} dos;
struct {
struct guid disk_guid;