aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-02-08 11:01:54 +0100
committerAndreas Färber <afaerber@suse.de>2014-02-14 21:12:04 +0100
commitf31c41ff5e7d64680382e94b9ea35d52ab4ca045 (patch)
tree78eddeec3b69d027dc3e1467ba90a75d6c40b734 /vl.c
parentc7bcc85d664b26b8b1e46416c7a730104b602e34 (diff)
block: Handle "rechs" and "large" translation options
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> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 0f7d31f047..071372d309 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;