diff options
author | Michal Soltys <soltys@ziu.info> | 2013-02-14 16:51:45 +0100 |
---|---|---|
committer | Michal Soltys <soltys@ziu.info> | 2013-02-14 16:53:04 +0100 |
commit | f8bed91e44366badaa207223f1f80d3ffac25ee7 (patch) | |
tree | 3aaf0d908ec15a121341e22fae768c3055f49dbe | |
parent | e0f464b253260e668d6602b07857c75a560b0616 (diff) | |
download | syslinux-f8bed91e44366badaa207223f1f80d3ffac25ee7.tar.gz syslinux-f8bed91e44366badaa207223f1f80d3ffac25ee7.tar.xz syslinux-f8bed91e44366badaa207223f1f80d3ffac25ee7.zip |
com32/chain: change stepall into flags
Signed-off-by: Michal Soltys <soltys@ziu.info>
-rw-r--r-- | com32/chain/mangle.c | 4 | ||||
-rw-r--r-- | com32/chain/partiter.c | 20 | ||||
-rw-r--r-- | 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 8185a17b..fbb5d57e 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 9352fcca..d8d6472b 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 4f5a23d7..ac15de63 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 **); |