summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@pond.sub.org>2009-06-18 15:14:10 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-06-22 10:15:29 -0500
commitc2cc47a449c3e16f7dd4d19a536c649ec56a9ac9 (patch)
tree77920d6d5fd89eb2d8513b49c1205a3656b28429 /vl.c
parent1f5f6638c063514f193ca447d49fa95f8a574a69 (diff)
downloadqemu-c2cc47a449c3e16f7dd4d19a536c649ec56a9ac9.tar.gz
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.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index ca26450e30..7ef97484bf 100644
--- a/vl.c
+++ b/vl.c
@@ -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;