[syslinux:master] chain.c32: simplify the grub4dos support

syslinux-bot for H. Peter Anvin hpa at zytor.com
Sun Jan 10 12:39:06 PST 2010


Commit-ID:  58e9e6510952e7c558b68e6d90e9fbd30156ba83
Gitweb:     http://syslinux.zytor.com/commit/58e9e6510952e7c558b68e6d90e9fbd30156ba83
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sun, 10 Jan 2010 12:36:30 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Sun, 10 Jan 2010 12:36:30 -0800

chain.c32: simplify the grub4dos support

Grub4dos (like Grub in general) uses the same partition numbers as
Linux (and chain.c32), minus one.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/modules/chain.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 3d192d7..2dd8074 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -781,25 +781,21 @@ int main(int argc, char *argv[])
     regs.ebx.b[0] = regs.edx.b[0] = drive;
 
     whichpart = 0;		/* Default */
-
-    /* grldr of Grub4dos wants the partition number in DH:
-	 0xff: whole drive (default)
-	 0-3:  primary partitions
-	 4-*:  logical partitions
-     */
-    regs.edx.b[1] = 0xff;
-
-    if (partition) {
+    if (partition)
 	whichpart = strtoul(partition, NULL, 0);
 
-	/* grldr of Grub4dos wants the partiton number in DH. */
-	regs.edx.b[1] = whichpart -1;
-    }
-
     if (!(drive & 0x80) && whichpart) {
 	error("Warning: Partitions of floppy devices may not work\n");
     }
 
+    /* 
+     * grldr of Grub4dos wants the partition number in DH:
+     * -1:   whole drive (default)
+     * 0-3:  primary partitions
+     * 4-*:  logical partitions
+     */
+    regs.edx.b[1] = whichpart-1;
+
     /* Get the disk geometry and disk access setup */
     if (get_disk_params(drive)) {
 	error("Cannot get disk parameters\n");



More information about the Syslinux-commits mailing list