aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Soltys <soltys@ziu.info>2014-06-29 21:41:40 +0200
committerH. Peter Anvin <hpa@zytor.com>2014-08-26 18:07:18 -0700
commit69e1b85fdee3db74cadf2e61e9ab34a9f70ab981 (patch)
treee31f22198a10564c6409be5f0c3f6272556adb24
parent9cffba471b6a41f363abc68509f112d9a85c4872 (diff)
downloadsyslinux-69e1b85fdee3db74cadf2e61e9ab34a9f70ab981.tar.gz
syslinux-69e1b85fdee3db74cadf2e61e9ab34a9f70ab981.tar.xz
syslinux-69e1b85fdee3db74cadf2e61e9ab34a9f70ab981.zip
chain/partiter: adjust error reporting
Use <0 for errors, 0 for normal state, and >0 for clean completion. In future this would be necessary if it's decided to make partiter a generic lib (similar to disklib) - though it has to be quieted first and provide strerr()-like functionality in place of its verbosity. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/chain/chain.c4
-rw-r--r--com32/chain/mangle.c4
-rw-r--r--com32/chain/partiter.h7
3 files changed, 5 insertions, 10 deletions
diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index ae95d45c..c08ec6e0 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -352,7 +352,7 @@ int find_dp(struct part_iter **_iter)
} while (!pi_next(iter));
/* broken part structure or other problems */
if (iter->status) {
- error("Can't find myself on the drive I booted from.");
+ error("Unable to find partition with syslinux (fs).");
goto bail;
}
}
@@ -372,7 +372,7 @@ int find_dp(struct part_iter **_iter)
break;
} while (!pi_next(iter));
if (iter->status) {
- error("Requested disk / partition combination not found.");
+ error("Unable to find requested disk / partition combination.");
goto bail;
}
}
diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c
index ffdaab8d..6963574f 100644
--- a/com32/chain/mangle.c
+++ b/com32/chain/mangle.c
@@ -562,7 +562,7 @@ int manglepe_hide(struct part_iter *miter)
}
}
- if (pi_errored(iter))
+ if (iter->status < 0)
goto bail;
/* last update */
@@ -663,7 +663,7 @@ int manglepe_fixchs(struct part_iter *miter)
}
}
- if (pi_errored(iter))
+ if (iter->status < 0)
goto bail;
/* last update */
diff --git a/com32/chain/partiter.h b/com32/chain/partiter.h
index 13dec848..d01a6500 100644
--- a/com32/chain/partiter.h
+++ b/com32/chain/partiter.h
@@ -42,7 +42,7 @@
/* status */
-enum {PI_OK, PI_DONE, PI_INSANE, PI_ERRLOAD};
+enum {PI_ERRLOAD = -31, PI_INSANE, PI_OK = 0, PI_DONE};
/* flags */
@@ -103,11 +103,6 @@ extern const struct itertype * const typeraw;
struct part_iter *pi_begin(const struct disk_info *, int flags);
void pi_del(struct part_iter **);
-static inline int pi_errored(struct part_iter *iter)
-{
- return iter->status > PI_DONE;
-}
-
/* inline virtuals */
static inline int pi_next(struct part_iter *iter)
{