[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translati
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options |
Date: |
Mon, 17 Feb 2014 23:24:55 +0100 |
From: Paolo Bonzini <address@hidden>
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 <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
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 0f7d31f..071372d 100644
--- a/vl.c
+++ b/vl.c
@@ -3073,14 +3073,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");
@@ -3094,10 +3099,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.4.5
- [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor, (continued)
- [Qemu-devel] [PULL v2 41/49] qapi: Add human mode to StringOutputVisitor, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 42/49] qdev: Use human mode in "info qtree", Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 43/49] qdev: Remove most legacy printers, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 46/49] qdev: Add enum property types to QAPI schema, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 44/49] qdev: Remove hex8/32/64 property types, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 47/49] qdev: Use QAPI type names for properties, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 48/49] qapi: Refine human printing of sizes, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 49/49] qtest: Include system headers before user headers, Andreas Färber, 2014/02/17
- [Qemu-devel] [PULL v2 45/49] block: Handle "rechs" and "large" translation options,
Andreas Färber <=
- Re: [Qemu-devel] [PULL v2 00/49] QOM devices patch queue 2014-02-17, Peter Maydell, 2014/02/20