[syslinux] [PATCH 12/28] com32/chain: cleaner variable names

Michal Soltys soltys at ziu.info
Tue Jan 29 06:05:59 PST 2013


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

diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c
index 2a14ef7..c928f35 100644
--- a/com32/chain/partiter.c
+++ b/com32/chain/partiter.c
@@ -177,7 +177,7 @@ static int notsane_logical(const struct part_iter *iter)
     if (!dp[0].start_lba ||
 	!dp[0].length ||
 	!sane(dp[0].start_lba, dp[0].length) ||
-	end_log > iter->dos.ebr_size) {
+	end_log > iter->dos.nebr_siz) {
 
 	error("Logical partition (in EBR) with invalid offset and/or length.\n");
 	return -1;
@@ -213,7 +213,7 @@ static int notsane_extended(const struct part_iter *iter)
     if (!dp[1].start_lba ||
 	!dp[1].length ||
 	!sane(dp[1].start_lba, dp[1].length) ||
-	end_ebr > iter->dos.bebr_size) {
+	end_ebr > iter->dos.bebr_siz) {
 
 	error("Extended partition (EBR) with invalid offset and/or length.\n");
 	return -1;
@@ -302,16 +302,14 @@ static int prep_base_ebr(struct part_iter *iter)
 
     if (iter->dos.bebr_index0 < 0)	/* if we don't have base extended partition at all */
 	return -1;
-    else if (!iter->dos.bebr_start) { /* if not initialized yet */
+    else if (!iter->dos.bebr_lba) { /* if not initialized yet */
 	dp = ((struct disk_dos_mbr *)iter->data)->table + iter->dos.bebr_index0;
 
-	iter->dos.bebr_start = dp->start_lba;
-	iter->dos.bebr_size = dp->length;
+	iter->dos.bebr_lba = dp->start_lba;
+	iter->dos.bebr_siz = dp->length;
 
-	iter->dos.ebr_size = iter->dos.bebr_size;
-
-	iter->dos.cebr_lba = 0;
-	iter->dos.nebr_lba = iter->dos.bebr_start;
+	iter->dos.nebr_lba = dp->start_lba;
+	iter->dos.nebr_siz = dp->length;
 
 	iter->index0--;
     }
@@ -337,6 +335,7 @@ static int dos_next_ebr(struct part_iter *iter, uint32_t *lba,
 	    return -1;
 	}
 
+	/* check sanity of loaded data */
 	if (notsane_logical(iter) || notsane_extended(iter)) {
 	    iter->status = PI_INSANE;
 	    return -1;
@@ -348,11 +347,11 @@ static int dos_next_ebr(struct part_iter *iter, uint32_t *lba,
 
 	/* setup next frame values */
 	if (dp[1].ostype) {
-	    iter->dos.ebr_size = dp[1].length;
-	    iter->dos.nebr_lba = iter->dos.bebr_start + dp[1].start_lba;
+	    iter->dos.nebr_lba = iter->dos.bebr_lba + dp[1].start_lba;
+	    iter->dos.nebr_siz = dp[1].length;
 	} else {
-	    iter->dos.ebr_size = 0;
 	    iter->dos.nebr_lba = 0;
+	    iter->dos.nebr_siz = 0;
 	}
 
 	if (!dp[0].ostype)
diff --git a/com32/chain/partiter.h b/com32/chain/partiter.h
index 813b9e6..63dc6da 100644
--- a/com32/chain/partiter.h
+++ b/com32/chain/partiter.h
@@ -73,13 +73,12 @@ struct part_iter {
 	struct {
 	    uint32_t disk_sig;    /* 32bit disk signature as stored in MBR */
 
-	    uint32_t bebr_start;  /* abs lba of base extended partition */
-	    uint32_t bebr_size;   /* 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 ebr_size;    /* size of next extended 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 */
-- 
1.7.10.4



More information about the Syslinux mailing list