[syslinux] [PATCH 23/23] com32/chain: use single value for partiter related options (flags)

Michal Soltys soltys at ziu.info
Mon Nov 5 16:32:57 PST 2012


Signed-off-by: Michal Soltys <soltys at ziu.info>
---
 com32/chain/chain.c   |   10 +++++-----
 com32/chain/mangle.c  |    4 ++--
 com32/chain/options.c |    8 ++++----
 com32/chain/options.h |    3 +--
 4 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index f205872..dcf6d0b 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 b87aa8e..6eab95d 100644
--- a/com32/chain/mangle.c
+++ b/com32/chain/mangle.c
@@ -541,7 +541,7 @@ int manglepe_hide(struct part_iter *miter)
     if (miter->index > 4 && !(opt.hide & 2))
 	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) {
@@ -643,7 +643,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 5d76219..42519be 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 008c9cb..d245aa7 100644
--- a/com32/chain/options.h
+++ b/com32/chain/options.h
@@ -47,8 +47,7 @@ struct options {
     addr_t soff;
     addr_t sip;
     int hide;
-    int relax;
-    int prefmbr;
+    int piflags;
     uint16_t keeppxe;
     bool isolinux;
     bool cmldr;
-- 
1.7.10.4




More information about the Syslinux mailing list