diff options
author | Michal Soltys <soltys@ziu.info> | 2011-03-08 20:18:50 +0100 |
---|---|---|
committer | Michal Soltys <soltys@ziu.info> | 2011-03-08 20:18:50 +0100 |
commit | bd4667bdf971bac20bf5cf8837c16301509e5f21 (patch) | |
tree | 4c46e86a1a10113465d4eb44735e765f28de9ddf | |
parent | e63b3ed60d172ab751300bcf9b620bee33e92451 (diff) | |
download | syslinux-bd4667bdf971bac20bf5cf8837c16301509e5f21.tar.gz syslinux-bd4667bdf971bac20bf5cf8837c16301509e5f21.tar.xz syslinux-bd4667bdf971bac20bf5cf8837c16301509e5f21.zip |
com32/chain: always report detected BPB
Signed-off-by: Michal Soltys <soltys@ziu.info>
-rw-r--r-- | com32/chain/mangle.c | 12 | ||||
-rw-r--r-- | com32/chain/utility.c | 25 | ||||
-rw-r--r-- | com32/chain/utility.h | 2 |
3 files changed, 17 insertions, 22 deletions
diff --git a/com32/chain/mangle.c b/com32/chain/mangle.c index 0aece16c..1525047d 100644 --- a/com32/chain/mangle.c +++ b/com32/chain/mangle.c @@ -243,10 +243,10 @@ bail: } #endif /* Adjust BPB common function */ -static int mangle_bpb(const struct part_iter *iter, struct data_area *data) +static int mangle_bpb(const struct part_iter *iter, struct data_area *data, const char *tag) { unsigned int off; - int type = bpb_detect(data->data); + int type = bpb_detect(data->data, tag); /* BPB: hidden sectors 32bit*/ if (type >= bpbV34) { @@ -292,7 +292,7 @@ int manglef_bpb(const struct part_iter *iter, struct data_area *data) if (!(opt.file && opt.filebpb)) return 0; - return mangle_bpb(iter, data); + return mangle_bpb(iter, data, "file"); } /* @@ -303,7 +303,7 @@ int mangles_bpb(const struct part_iter *iter, struct data_area *data) if (!(opt.sect && opt.setbpb)) return 0; - return mangle_bpb(iter, data); + return mangle_bpb(iter, data, "sect"); } /* @@ -318,8 +318,8 @@ int manglesf_bss(struct data_area *sec, struct data_area *fil) if (!(opt.sect && opt.file && opt.bss)) return 0; - type1 = bpb_detect(fil->data); - type2 = bpb_detect(sec->data); + type1 = bpb_detect(fil->data, "bss/file"); + type2 = bpb_detect(sec->data, "bss/sect"); if (!type1 || !type2) { error("Couldn't determine the BPB type for option 'bss'.\n"); diff --git a/com32/chain/utility.c b/com32/chain/utility.c index b30042b5..f0bfd8fd 100644 --- a/com32/chain/utility.c +++ b/com32/chain/utility.c @@ -7,18 +7,16 @@ #include <syslinux/disk.h> #include "utility.h" -#ifdef DEBUG static const char *bpbtypes[] = { - [0] = "BPB unknown", - [1] = "BPB v.2.0", - [2] = "BPB v.3.0", - [3] = "BPB v.3.2", - [4] = "BPB v.3.4", - [5] = "BPB v.4.0", - [6] = "BPB v.NT+", - [7] = "BPB v.7.0", + [0] = "unknown", + [1] = "2.0", + [2] = "3.0", + [3] = "3.2", + [4] = "3.4", + [5] = "4.0", + [6] = "8.0 (NT+)", + [7] = "7.0", }; -#endif void error(const char *msg) { @@ -148,7 +146,7 @@ int drvoff_detect(int type, unsigned int *off) /* * heuristics could certainly be improved */ -int bpb_detect(const uint8_t *sec) +int bpb_detect(const uint8_t *sec, const char *tag) { int a, b, c, jmp = -1, rev = 0; @@ -207,11 +205,8 @@ nocode: } out: -#ifdef DEBUG - printf("INFO: BPB detection: %s\n", bpbtypes[rev]); -#endif + printf("BPB detection (%s): %s\n", tag, bpbtypes[rev]); return rev; } - /* vim: set ts=8 sts=4 sw=4 noet: */ diff --git a/com32/chain/utility.h b/com32/chain/utility.h index db55bc7d..9a40bc65 100644 --- a/com32/chain/utility.h +++ b/com32/chain/utility.h @@ -23,7 +23,7 @@ void wait_key(void); uint32_t lba2chs(const struct disk_info *di, uint64_t lba, uint32_t mode); uint32_t get_file_lba(const char *filename); int drvoff_detect(int type, unsigned int *off); -int bpb_detect(const uint8_t *bpb); +int bpb_detect(const uint8_t *bpb, const char *tag); #endif |