diff options
author | Markus Armbruster <armbru@pond.sub.org> | 2009-06-18 15:14:10 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-22 10:15:29 -0500 |
commit | c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9 (patch) | |
tree | 77920d6d5fd89eb2d8513b49c1205a3656b28429 /vl.c | |
parent | Make first argument of monitor command pci_add work (diff) | |
download | qemu-kvm-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.tar.gz qemu-kvm-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.tar.bz2 qemu-kvm-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.zip |
Support addr=... in option argument of -drive if=virtio
Make drive_init() accept addr=, put the value into struct DriveInfo.
Use it in all the places that create virtio-blk-pci devices:
pc_init1(), bamboo_init(), mpc8544ds_init().
Don't support addr= in third argument of monitor command pci_add and
second argument of drive_add, because that clashes with their first
arguments. Admittedly unelegant.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -2209,12 +2209,14 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) int index; int cache; int bdrv_flags, onerror; + const char *devaddr; int drives_table_idx; char *str = arg->opt; static const char * const params[] = { "bus", "unit", "if", "index", "cyls", "heads", "secs", "trans", "media", "snapshot", "file", - "cache", "format", "serial", "werror", + "cache", "format", "serial", + "werror", "addr", NULL }; if (check_params(buf, sizeof(buf), params, str) < 0) { @@ -2428,6 +2430,15 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) } } + devaddr = NULL; + if (get_param_value(buf, sizeof(buf), "addr", str)) { + if (type != IF_VIRTIO) { + fprintf(stderr, "addr is not supported by in '%s'\n", str); + return -1; + } + devaddr = strdup(buf); + } + /* compute bus and unit according index */ if (index != -1) { @@ -2489,6 +2500,7 @@ int drive_init(struct drive_opt *arg, int snapshot, void *opaque) bdrv = bdrv_new(buf); drives_table_idx = drive_get_free_idx(); drives_table[drives_table_idx].bdrv = bdrv; + drives_table[drives_table_idx].devaddr = devaddr; drives_table[drives_table_idx].type = type; drives_table[drives_table_idx].bus = bus_id; drives_table[drives_table_idx].unit = unit_id; |