[syslinux:master] com32/chain: make raw handover use total sectors info

syslinux-bot for Michal Soltys soltys at ziu.info
Mon Mar 26 15:03:22 PDT 2012


Commit-ID:  0104b5d220f8cc5676a7c09b5689d7b13023fac1
Gitweb:     http://www.syslinux.org/commit/0104b5d220f8cc5676a7c09b5689d7b13023fac1
Author:     Michal Soltys <soltys at ziu.info>
AuthorDate: Tue, 5 Oct 2010 20:47:20 +0200
Committer:  Michal Soltys <soltys at ziu.info>
CommitDate: Fri, 8 Oct 2010 12:40:51 +0200

com32/chain: make raw handover use total sectors info

With disklib update providing total sectors info, make raw handover
use it (instead of forcing arbitrary number).

Signed-off-by: Michal Soltys <soltys at ziu.info>

---
 com32/chain/chain.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/com32/chain/chain.c b/com32/chain/chain.c
index ae46fec..9fdb6ce 100644
--- a/com32/chain/chain.c
+++ b/com32/chain/chain.c
@@ -603,12 +603,15 @@ static int setup_handover(const struct part_iter *iter,
 	    goto bail;
 	}
 	if (!iter->index) {
+	    uint32_t len = ~0u;
+	    if (iter->di.lbacnt < len)
+		len = (uint32_t)iter->di.lbacnt;
 	    *(uint32_t *)ha->start = lba2chs(&iter->di, 0, l2c_cadd);
-	    *(uint32_t *)ha->end = lba2chs(&iter->di, 2879, l2c_cadd);
+	    *(uint32_t *)ha->end = lba2chs(&iter->di, len - 1, l2c_cadd);
 	    ha->active_flag = 0x80;
-	    ha->ostype = 0xDA;
+	    ha->ostype = 0xDA;	/* "Non-FS Data", anything is good here though ... */
 	    ha->start_lba = 0;
-	    ha->length = 2880;
+	    ha->length = len;
 	} else if (iter->type == typedos) {
 	    dp = (const struct disk_dos_part_entry *)iter->record;
 


More information about the Syslinux-commits mailing list