qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 11/14] block: handle "rechs" and "large" translation options
Date: Sat,  8 Feb 2014 11:01:54 +0100	[thread overview]
Message-ID: <1391853717-3837-12-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1391853717-3837-1-git-send-email-pbonzini@redhat.com>

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 <stefanha@gmail.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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

  parent reply	other threads:[~2014-02-08 10:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 10:01 [Qemu-devel] [PULL 00/14] Cleanup qdev legacy properties Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 01/14] qapi: add size parser to StringInputVisitor Paolo Bonzini
2014-02-10 18:07   ` Andreas Färber
2014-02-08 10:01 ` [Qemu-devel] [PULL 02/14] qdev: sizes are now parsed by StringInputVisitor Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 03/14] qdev: remove legacy parsers for hex8/32/64 Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 04/14] qdev: legacy properties are now read-only Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 05/14] qdev: legacy properties are just strings Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 06/14] qdev: inline qdev_prop_parse Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 07/14] qapi: add human mode to StringOutputVisitor Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 08/14] qdev: use human mode in "info qtree" Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 09/14] qdev: remove most legacy printers Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 10/14] qdev: remove hex8/32/64 property types Paolo Bonzini
2014-02-08 10:01 ` Paolo Bonzini [this message]
2014-02-08 10:01 ` [Qemu-devel] [PULL 12/14] qdev: add enum property types to QAPI schema Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 13/14] qdev: use QAPI type names for properties Paolo Bonzini
2014-02-08 10:01 ` [Qemu-devel] [PULL 14/14] qapi: refine human printing of sizes Paolo Bonzini
2014-02-08 14:24 ` [Qemu-devel] [PULL 00/14] Cleanup qdev legacy properties Andreas Färber
2014-02-09 10:57   ` Igor Mammedov
2014-02-09 14:03   ` Paolo Bonzini
2014-02-10  9:20   ` Markus Armbruster
2014-02-10 14:42     ` Andreas Färber
2014-02-10 16:01       ` Markus Armbruster
2014-02-10 18:40       ` Peter Maydell
2014-02-10 22:01         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391853717-3837-12-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).