From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WC4k9-00085F-AL for qemu-devel@nongnu.org; Sat, 08 Feb 2014 05:02:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WC4k0-0004Mk-GT for qemu-devel@nongnu.org; Sat, 08 Feb 2014 05:02:37 -0500 Received: from mail-ee0-x22c.google.com ([2a00:1450:4013:c00::22c]:55970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WC4k0-0004MB-70 for qemu-devel@nongnu.org; Sat, 08 Feb 2014 05:02:28 -0500 Received: by mail-ee0-f44.google.com with SMTP id c13so1952003eek.31 for ; Sat, 08 Feb 2014 02:02:27 -0800 (PST) Received: from yakj.usersys.redhat.com.cz (auth47-172.fi.muni.cz. [147.251.47.172]) by mx.google.com with ESMTPSA id k41sm27156087een.19.2014.02.08.02.02.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Feb 2014 02:02:26 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Sat, 8 Feb 2014 11:01:54 +0100 Message-Id: <1391853717-3837-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1391853717-3837-1-git-send-email-pbonzini@redhat.com> References: <1391853717-3837-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 11/14] block: handle "rechs" and "large" translation options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Sure, CHS translation is an obscure topic, and legacy options for hard-disk geometries are obscure as well. But since QEMU does nothing with it except telling the BIOS, and since there "large" and "rechs" are listed in the enums, parsing them seems to be the bare minimum. Acked-by: Stefan Hajnoczi Reviewed-by: Igor Mammedov Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- blockdev.c | 4 ++++ hw/core/qdev-properties.c | 8 +++++--- vl.c | 22 ++++++++++++++++------ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/blockdev.c b/blockdev.c index 36ceece..d71f815 100644 --- a/blockdev.c +++ b/blockdev.c @@ -776,6 +776,10 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type) translation = BIOS_ATA_TRANSLATION_NONE; } else if (!strcmp(value, "lba")) { translation = BIOS_ATA_TRANSLATION_LBA; + } else if (!strcmp(value, "large")) { + translation = BIOS_ATA_TRANSLATION_LARGE; + } else if (!strcmp(value, "rechs")) { + translation = BIOS_ATA_TRANSLATION_RECHS; } else if (!strcmp(value, "auto")) { translation = BIOS_ATA_TRANSLATION_AUTO; } else { diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 2c3a756..76a0c4d 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -469,9 +469,11 @@ PropertyInfo qdev_prop_losttickpolicy = { /* --- BIOS CHS translation */ static const char *bios_chs_trans_table[] = { - [BIOS_ATA_TRANSLATION_AUTO] = "auto", - [BIOS_ATA_TRANSLATION_NONE] = "none", - [BIOS_ATA_TRANSLATION_LBA] = "lba", + [BIOS_ATA_TRANSLATION_AUTO] = "auto", + [BIOS_ATA_TRANSLATION_NONE] = "none", + [BIOS_ATA_TRANSLATION_LBA] = "lba", + [BIOS_ATA_TRANSLATION_LARGE] = "large", + [BIOS_ATA_TRANSLATION_RECHS] = "rechs", }; PropertyInfo qdev_prop_bios_chs_trans = { diff --git a/vl.c b/vl.c index 7f4fe0d..46112af 100644 --- a/vl.c +++ b/vl.c @@ -3053,14 +3053,19 @@ int main(int argc, char **argv, char **envp) goto chs_fail; if (*p == ',') { p++; - if (!strcmp(p, "none")) + if (!strcmp(p, "large")) { + translation = BIOS_ATA_TRANSLATION_LARGE; + } else if (!strcmp(p, "rechs")) { + translation = BIOS_ATA_TRANSLATION_RECHS; + } else if (!strcmp(p, "none")) { translation = BIOS_ATA_TRANSLATION_NONE; - else if (!strcmp(p, "lba")) + } else if (!strcmp(p, "lba")) { translation = BIOS_ATA_TRANSLATION_LBA; - else if (!strcmp(p, "auto")) + } else if (!strcmp(p, "auto")) { translation = BIOS_ATA_TRANSLATION_AUTO; - else + } else { goto chs_fail; + } } else if (*p != '\0') { chs_fail: fprintf(stderr, "qemu: invalid physical CHS format\n"); @@ -3074,10 +3079,15 @@ int main(int argc, char **argv, char **envp) qemu_opt_set(hda_opts, "heads", num); snprintf(num, sizeof(num), "%d", secs); qemu_opt_set(hda_opts, "secs", num); - if (translation == BIOS_ATA_TRANSLATION_LBA) + if (translation == BIOS_ATA_TRANSLATION_LARGE) { + qemu_opt_set(hda_opts, "trans", "large"); + } else if (translation == BIOS_ATA_TRANSLATION_RECHS) { + qemu_opt_set(hda_opts, "trans", "rechs"); + } else if (translation == BIOS_ATA_TRANSLATION_LBA) { qemu_opt_set(hda_opts, "trans", "lba"); - if (translation == BIOS_ATA_TRANSLATION_NONE) + } else if (translation == BIOS_ATA_TRANSLATION_NONE) { qemu_opt_set(hda_opts, "trans", "none"); + } } } break; -- 1.8.5.3