[syslinux:elflink] com32/chain: change stepall into flags

syslinux-bot for Michal Soltys soltys at ziu.info
Sat Feb 16 01:48:08 PST 2013


Commit-ID:  f8bed91e44366badaa207223f1f80d3ffac25ee7
Gitweb:     http://www.syslinux.org/commit/f8bed91e44366badaa207223f1f80d3ffac25ee7
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Thu, 14 Feb 2013 16:51:45 +0100
Committer:  Michal Soltys <soltys at ziu.info>
CommitDate: Thu, 14 Feb 2013 16:53:04 +0100

com32/chain: change stepall into flags

Signed-off-by: Michal Soltys <soltys at ziu.info>

---
 com32/chain/mangle.c   |  4 ++--
 com32/chain/partiter.c | 20 ++++++++++----------
 com32/chain/partiter.h |  8 ++++++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c
index 8185a17..fbb5d57 100644
--- a/com32/chain/mangle.c
+++ b/com32/chain/mangle.c
@@ -540,7 +540,7 @@ int manglepe_hide(struct part_iter *miter)
     if (miter->index > 4 && !(opt.hide & 2))
 	error("WARNING: your partition is beyond mbr, so it can't be unhidden without '*hideall'.\n");
 
-    if (!(iter = pi_begin(&miter->di, 1)))  /* turn stepall on */
+    if (!(iter = pi_begin(&miter->di, PIF_STEPALL)))
 	return -1;
 
     while (!pi_next(&iter) && !werr) {
@@ -610,7 +610,7 @@ int manglepe_fixchs(struct part_iter *miter)
 	return -1;
     }
 
-    if (!(iter = pi_begin(&miter->di, 1)))  /* turn stepall on */
+    if (!(iter = pi_begin(&miter->di, PIF_STEPALL)))
 	return -1;
 
     while (!pi_next(&iter) && !werr) {
diff --git a/com32/chain/partiter.c b/com32/chain/partiter.c
index 9352fcc..d8d6472 100644
--- a/com32/chain/partiter.c
+++ b/com32/chain/partiter.c
@@ -93,14 +93,14 @@ static int inv_type(const void *type)
  * iter_ctor() - common iterator initialization
  * @iter:	iterator pointer
  * @args(0):	disk_info structure used for disk functions
- * @args(1):	stepall modifier
+ * @args(1):	flags modifier
  *
  * Second and further arguments are passed as a pointer to va_list
  **/
 static int iter_ctor(struct part_iter *iter, va_list *args)
 {
     const struct disk_info *di = va_arg(*args, const struct disk_info *);
-    int stepall = va_arg(*args, int);
+    int flags = va_arg(*args, int);
 
 #ifdef DEBUG
     if (!di)
@@ -108,7 +108,7 @@ static int iter_ctor(struct part_iter *iter, va_list *args)
 #endif
 
     memcpy(&iter->di, di, sizeof(struct disk_info));
-    iter->stepall = stepall;
+    iter->flags = flags;
     iter->index0 = -1;
     iter->length = di->lbacnt;
 
@@ -356,7 +356,7 @@ static int pi_dos_next_mbr(struct part_iter *iter, uint32_t *lba,
 	    /* record base EBR index */
 	    iter->dos.bebr_index0 = iter->index0;
 	}
-	if (!ost_is_nondata(dp->ostype) || iter->stepall) {
+	if (!ost_is_nondata(dp->ostype) || (iter->flags & PIF_STEPALL)) {
 	    *lba = dp->start_lba;
 	    *_dp = dp;
 	    break;
@@ -433,7 +433,7 @@ static int pi_dos_next_ebr(struct part_iter *iter, uint32_t *lba,
 	if (!dp[0].ostype)
 	    iter->dos.skipcnt++;
 
-	if (dp[0].ostype || iter->stepall) {
+	if (dp[0].ostype || (iter->flags & PIF_STEPALL)) {
 	    *lba = iter->dos.cebr_lba + dp[0].start_lba;
 	    *_dp = dp;
 	    return 0;
@@ -524,7 +524,7 @@ static struct part_iter *pi_gpt_next(struct part_iter *iter)
 	    goto bail;
 	}
 
-	if (!guid_is0(&gpt_part->type) || iter->stepall)
+	if (!guid_is0(&gpt_part->type) || (iter->flags & PIF_STEPALL))
 	    break;
     }
     /* no more partitions ? */
@@ -701,7 +701,7 @@ void pi_del(struct part_iter **_iter)
  * This function checks the disk for GPT or legacy partition table and allocates
  * an appropriate iterator.
  **/
-struct part_iter *pi_begin(const struct disk_info *di, int stepall)
+struct part_iter *pi_begin(const struct disk_info *di, int flags)
 {
     int setraw = 0;
     struct part_iter *iter = NULL;
@@ -784,17 +784,17 @@ struct part_iter *pi_begin(const struct disk_info *di, int stepall)
 	    }
 	}
 	/* allocate iterator and exit */
-	iter = pi_new(typegpt, di, stepall, gpth, gptl);
+	iter = pi_new(typegpt, di, flags, gpth, gptl);
     } else {
 	/* looks like MBR */
-	iter = pi_new(typedos, di, stepall, mbr);
+	iter = pi_new(typedos, di, flags, mbr);
     }
 
     setraw = 0;
 bail:
     if (setraw) {
 	error("WARNING: treating disk as raw.\n");
-	iter = pi_new(typeraw, di, stepall);
+	iter = pi_new(typeraw, di, flags);
     }
     free(mbr);
     free(gpth);
diff --git a/com32/chain/partiter.h b/com32/chain/partiter.h
index 4f5a23d..ac15de6 100644
--- a/com32/chain/partiter.h
+++ b/com32/chain/partiter.h
@@ -45,6 +45,10 @@
 #define PI_DONE 1
 #define PI_OK 0
 
+/* behaviour flags */
+
+#define PIF_STEPALL 0x01
+
 struct itertype;
 struct part_iter;
 
@@ -65,7 +69,7 @@ struct part_iter {
     int index;
     int rawindex;
     struct disk_info di;
-    int stepall;
+    int flags;
     int status;
     /* internal */
     int index0;
@@ -98,7 +102,7 @@ extern const struct itertype * const typedos;
 extern const struct itertype * const typegpt;
 extern const struct itertype * const typeraw;
 
-struct part_iter *pi_begin(const struct disk_info *, int stepall);
+struct part_iter *pi_begin(const struct disk_info *, int flags);
 struct part_iter *pi_new(const struct itertype *, ...);
 void pi_del(struct part_iter **);
 int pi_next(struct part_iter **);


More information about the Syslinux-commits mailing list