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
commit5dd95bd511d8f45a588ba465cf9448bd2da1c1e3 (patch)
tree1a63803cd89bcc5d5aeef6c2168f635bcc553222
parent7967456288ac936c654d3da118e36a552ccfbda5 (diff)
downloadsyslinux-5dd95bd511d8f45a588ba465cf9448bd2da1c1e3.tar.gz
syslinux-5dd95bd511d8f45a588ba465cf9448bd2da1c1e3.tar.xz
syslinux-5dd95bd511d8f45a588ba465cf9448bd2da1c1e3.zip
com32/chain: use single value for partiter related options (flags)
Also use enum instead of #defines for flags. Signed-off-by: Michal Soltys <soltys@ziu.info>
-rw-r--r--com32/chain/chain.c10
-rw-r--r--com32/chain/mangle.c4
-rw-r--r--com32/chain/options.c8
-rw-r--r--com32/chain/options.h3
-rw-r--r--com32/chain/partiter.h4
5 files changed, 13 insertions, 16 deletions
diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index 93796023..bcc64688 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -71,7 +71,7 @@ static int find_by_sig(uint32_t mbr_sig,
for (drive = 0x80; drive < 0x80 + fixed_cnt; drive++) {
if (disk_get_params(drive, &diskinfo))
continue; /* Drive doesn't exist */
- if (!(boot_part = pi_begin(&diskinfo, opt.relax | opt.prefmbr)))
+ if (!(boot_part = pi_begin(&diskinfo, opt.piflags)))
continue;
/* Check for a MBR disk */
if (boot_part->type != typedos) {
@@ -102,7 +102,7 @@ static int find_by_guid(const struct guid *gpt_guid,
for (drive = 0x80; drive < 0x80 + fixed_cnt; drive++) {
if (disk_get_params(drive, &diskinfo))
continue; /* Drive doesn't exist */
- if (!(boot_part = pi_begin(&diskinfo, opt.relax | opt.prefmbr)))
+ if (!(boot_part = pi_begin(&diskinfo, opt.piflags)))
continue;
/* Check for a GPT disk */
if (boot_part->type != typegpt) {
@@ -134,7 +134,7 @@ static int find_by_label(const char *label, struct part_iter **_boot_part)
for (drive = 0x80; drive < 0x80 + fixed_cnt; drive++) {
if (disk_get_params(drive, &diskinfo))
continue; /* Drive doesn't exist */
- if (!(boot_part = pi_begin(&diskinfo, opt.relax | opt.prefmbr)))
+ if (!(boot_part = pi_begin(&diskinfo, opt.piflags)))
continue;
/* Check for a GPT disk */
if (!(boot_part->type == typegpt)) {
@@ -321,7 +321,7 @@ int find_dp(struct part_iter **_iter)
if (disk_get_params(drive, &diskinfo))
goto bail;
/* this will start iteration over FDD, possibly raw */
- if (!(iter = pi_begin(&diskinfo, opt.relax | opt.prefmbr)))
+ if (!(iter = pi_begin(&diskinfo, opt.piflags)))
goto bail;
} else if (!strcmp(opt.drivename, "boot") || !strcmp(opt.drivename, "fs")) {
@@ -341,7 +341,7 @@ int find_dp(struct part_iter **_iter)
if (disk_get_params(drive, &diskinfo))
goto bail;
/* this will start iteration over disk emulation, possibly raw */
- if (!(iter = pi_begin(&diskinfo, opt.relax | opt.prefmbr)))
+ if (!(iter = pi_begin(&diskinfo, opt.piflags)))
goto bail;
/* 'fs' => we should lookup the syslinux partition number and use it */
diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c
index a49fcfbb..0c7319b3 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 & HIDE_EXT))
warn("Specified partition is logical, so it can't be unhidden without 'unhideall'.");
- if (!(iter = pi_begin(&miter->di, PIF_STEPALL | opt.relax | opt.prefmbr)))
+ if (!(iter = pi_begin(&miter->di, PIF_STEPALL | opt.piflags)))
return -1;
while (!pi_next(iter) && !werr) {
@@ -642,7 +642,7 @@ int manglepe_fixchs(struct part_iter *miter)
return -1;
}
- if (!(iter = pi_begin(&miter->di, PIF_STEPALL | opt.relax | opt.prefmbr)))
+ if (!(iter = pi_begin(&miter->di, PIF_STEPALL | opt.piflags)))
return -1;
while (!pi_next(iter) && !werr) {
diff --git a/com32/chain/options.c b/com32/chain/options.c
index 531caf82..38881e77 100644
--- a/com32/chain/options.c
+++ b/com32/chain/options.c
@@ -336,17 +336,17 @@ int opt_parse_args(int argc, char *argv[])
} else if (!strcmp(argv[i], "nofixchs")) {
opt.fixchs = false;
} else if (!strcmp(argv[i], "relax")) {
- opt.relax = PIF_RELAX;
+ opt.piflags |= PIF_RELAX;
} else if (!strcmp(argv[i], "norelax")) {
- opt.relax = 0;
+ opt.piflags &= ~PIF_RELAX;
} else if (!strcmp(argv[i], "warn")) {
opt.warn = true;
} else if (!strcmp(argv[i], "nowarn")) {
opt.warn = false;
} else if (!strcmp(argv[i], "prefmbr")) {
- opt.prefmbr = PIF_PREFMBR;
+ opt.piflags |= PIF_PREFMBR;
} else if (!strcmp(argv[i], "noprefmbr")) {
- opt.prefmbr = 0;
+ opt.piflags &= ~PIF_PREFMBR;
} else if (!strcmp(argv[i], "nobreak")) {
opt.brkchain = false;
} else if (!strcmp(argv[i], "break")) {
diff --git a/com32/chain/options.h b/com32/chain/options.h
index 7b625826..df96e2d3 100644
--- a/com32/chain/options.h
+++ b/com32/chain/options.h
@@ -49,8 +49,7 @@ struct options {
addr_t soff;
addr_t sip;
int hide;
- int relax;
- int prefmbr;
+ int piflags;
uint16_t keeppxe;
bool isolinux;
bool cmldr;
diff --git a/com32/chain/partiter.h b/com32/chain/partiter.h
index 3d2a151b..ab4922ca 100644
--- a/com32/chain/partiter.h
+++ b/com32/chain/partiter.h
@@ -46,9 +46,7 @@ enum {PI_OK, PI_DONE, PI_INSANE, PI_ERRLOAD};
/* flags */
-#define PIF_STEPALL 0b001
-#define PIF_RELAX 0b010
-#define PIF_PREFMBR 0b100
+enum {PIF_STEPALL = 1, PIF_RELAX = 2, PIF_PREFMBR = 4};
struct itertype;
struct part_iter;