From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8rMX-0003tj-8z for qemu-devel@nongnu.org; Thu, 30 Jan 2014 08:09:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8rMO-0002WY-9q for qemu-devel@nongnu.org; Thu, 30 Jan 2014 08:08:57 -0500 Received: from mail-ea0-f172.google.com ([209.85.215.172]:39708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8rMO-0002WL-20 for qemu-devel@nongnu.org; Thu, 30 Jan 2014 08:08:48 -0500 Received: by mail-ea0-f172.google.com with SMTP id l9so484795eaj.31 for ; Thu, 30 Jan 2014 05:08:11 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 Jan 2014 14:08:02 +0100 Message-Id: <1391087282-17686-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] block: handle "rechs" translation option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com The rechs translation option is so obscure that we support it but do not even attempt to parse it. Archeologists will surely be puzzled by this (assuming they care about QEMU and CHS translation), so fix it. Signed-off-by: Paolo Bonzini --- blockdev.c | 2 ++ vl.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/blockdev.c b/blockdev.c index 36ceece..5946bbe 100644 --- a/blockdev.c +++ b/blockdev.c @@ -776,6 +776,8 @@ 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, "rechs")) { + translation = BIOS_ATA_TRANSLATION_RECHS; } else if (!strcmp(value, "auto")) { translation = BIOS_ATA_TRANSLATION_AUTO; } else { diff --git a/vl.c b/vl.c index 7f4fe0d..f161a727f 100644 --- a/vl.c +++ b/vl.c @@ -3053,14 +3053,17 @@ int main(int argc, char **argv, char **envp) goto chs_fail; if (*p == ',') { p++; - if (!strcmp(p, "none")) + 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, "rechs")) { + translation = BIOS_ATA_TRANSLATION_RECHS; + } 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 +3077,13 @@ 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_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.4.2