From b4ba30102958f77e6bef1354459a06416408c2d7 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Sun, 22 Aug 2010 13:44:01 +0200 Subject: chain.c: Split chain into smaller files new file: chain.h new file: common.h new file: mangle.c new file: mangle.h new file: options.c new file: options.h new file: utility.c new file: utility.h Signed-off-by: Michal Soltys --- com32/chain/utility.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 com32/chain/utility.h (limited to 'com32/chain/utility.h') diff --git a/com32/chain/utility.h b/com32/chain/utility.h new file mode 100644 index 00000000..b77f633b --- /dev/null +++ b/com32/chain/utility.h @@ -0,0 +1,15 @@ +#ifndef _COM32_CHAIN_UTILITY_H +#define _COM32_CHAIN_UTILITY_H + +#include +#include + +void error(const char *msg); +int guid_is0(const struct guid *guid); +void wait_key(void); +uint32_t lba2chs(const struct disk_info *di, uint64_t lba); +uint32_t get_file_lba(const char *filename); + +#endif + +/* vim: set ts=8 sts=4 sw=4 noet: */ -- cgit v1.2.1 From 0d591b9348e43cf59cd4857dcc0e9029566d96e5 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Sat, 28 Aug 2010 01:06:13 +0200 Subject: chain module: setbpb changes, bss & bs options, bugfixes Generic function detecting BPB type (7 versions) have been added. set{hid,geo,drv} have been replaced by single setbpb option, using mentioned function to make more precise decisions what to update where. Full BSS and BS emulation has been added, also employing BPB detection. Some logic/flow changes in chain's main(). There was also a bug, in which backup sector was populated with wrong data. Appropriate documentation updates. Signed-off-by: Michal Soltys --- com32/chain/utility.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'com32/chain/utility.h') diff --git a/com32/chain/utility.h b/com32/chain/utility.h index b77f633b..0cdb36f2 100644 --- a/com32/chain/utility.h +++ b/com32/chain/utility.h @@ -4,11 +4,21 @@ #include #include +#define bpbV20 1 +#define bpbV30 2 +#define bpbV32 3 +#define bpbV34 4 +#define bpbV40 5 +#define bpbVNT 6 +#define bpbV70 7 + void error(const char *msg); int guid_is0(const struct guid *guid); void wait_key(void); uint32_t lba2chs(const struct disk_info *di, uint64_t lba); uint32_t get_file_lba(const char *filename); +int drvoff_detect(int type, unsigned int *off); +int bpb_detect(const uint8_t *bpb); #endif -- cgit v1.2.1 From d4cbb325b3ef7e999ccf8ed9ac5fe8da102ab5f4 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Sat, 28 Aug 2010 13:20:31 +0200 Subject: chain module: bugfixing and cosmetics Bugs: - one introduced ages ago - find_by_* functions should be tested vs. <0 for failure - one introduced by 579f15c7c456c - it accidentally blocked too much when testing for ',' in drive/partition option parsing - one introduced by d4d713c9ccfe0 - sone machines / VMs seem to set @40:75 just 1, regardless of amount of fixed disks available Signed-off-by: Michal Soltys --- com32/chain/utility.h | 1 + 1 file changed, 1 insertion(+) (limited to 'com32/chain/utility.h') diff --git a/com32/chain/utility.h b/com32/chain/utility.h index 0cdb36f2..4f50e0ea 100644 --- a/com32/chain/utility.h +++ b/com32/chain/utility.h @@ -4,6 +4,7 @@ #include #include +#define bpbUNK 0 #define bpbV20 1 #define bpbV30 2 #define bpbV32 3 -- cgit v1.2.1 From 81f86009696b5c7eff76e1981e967367235c5f7c Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Tue, 28 Sep 2010 19:57:28 +0200 Subject: com32/chain: utility's lba2chs update This patch adds 3 modes of operation to lba2chs: l2c_cnul - strict cylinder mode, using at most the value returned by 13h/48h or 13h/08h l2c_cadd - allow using 1 cylinder more. Only if cylinders are less than 1024 and total drive's lba size is not on a cylinder boundary. l2c_max - allow using any cylinder number. Modes have effect only if CHS geometry (cbios) is valid. chain.c uses l2c_cadd. Signed-off-by: Michal Soltys --- com32/chain/utility.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'com32/chain/utility.h') diff --git a/com32/chain/utility.h b/com32/chain/utility.h index 4f50e0ea..db55bc7d 100644 --- a/com32/chain/utility.h +++ b/com32/chain/utility.h @@ -13,10 +13,14 @@ #define bpbVNT 6 #define bpbV70 7 +#define l2c_cnul 0 +#define l2c_cadd 1 +#define l2c_cmax 2 + void error(const char *msg); int guid_is0(const struct guid *guid); void wait_key(void); -uint32_t lba2chs(const struct disk_info *di, uint64_t lba); +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); -- cgit v1.2.1 From bd4667bdf971bac20bf5cf8837c16301509e5f21 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Tue, 8 Mar 2011 20:18:50 +0100 Subject: com32/chain: always report detected BPB Signed-off-by: Michal Soltys --- com32/chain/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'com32/chain/utility.h') 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 -- cgit v1.2.1 From 4bcdb24bdb463e8b5cdf5d54a950b5e82776874b Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Wed, 9 Mar 2011 00:15:36 +0100 Subject: com32/chain: modify lba2chs() towards using disk_chs type Signed-off-by: Michal Soltys --- com32/chain/utility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'com32/chain/utility.h') diff --git a/com32/chain/utility.h b/com32/chain/utility.h index 9a40bc65..8a08be71 100644 --- a/com32/chain/utility.h +++ b/com32/chain/utility.h @@ -20,7 +20,7 @@ void error(const char *msg); int guid_is0(const struct guid *guid); void wait_key(void); -uint32_t lba2chs(const struct disk_info *di, uint64_t lba, uint32_t mode); +void lba2chs(disk_chs *dst, 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, const char *tag); -- cgit v1.2.1