diff options
author | Max Reitz <mreitz@redhat.com> | 2014-03-08 00:39:41 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-03-13 14:42:24 +0100 |
commit | 7af803d4f80efb56c250f16409501994e60adf60 (patch) | |
tree | 17245f55c795129cd31a9f8924f726fad93553d4 /block/raw-posix.c | |
parent | f988388025c230ef3293cc0c3820cb40e03adfbf (diff) | |
download | qemu-7af803d4f80efb56c250f16409501994e60adf60.zip |
block/raw-posix: bdrv_parse_filename() for hdev
The "host_device" protocol driver should strip the "host_device:" prefix
from filenames if present.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r-- | block/raw-posix.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index e6b4c1fe02..ab32ff99da 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1561,6 +1561,15 @@ static int check_hdev_writable(BDRVRawState *s) return 0; } +static void hdev_parse_filename(const char *filename, QDict *options, + Error **errp) +{ + /* The prefix is optional, just as for "file". */ + strstart(filename, "host_device:", &filename); + + qdict_put_obj(options, "filename", QOBJECT(qstring_from_str(filename))); +} + static int hdev_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -1805,6 +1814,7 @@ static BlockDriver bdrv_host_device = { .instance_size = sizeof(BDRVRawState), .bdrv_needs_filename = true, .bdrv_probe_device = hdev_probe_device, + .bdrv_parse_filename = hdev_parse_filename, .bdrv_file_open = hdev_open, .bdrv_close = raw_close, .bdrv_reopen_prepare = raw_reopen_prepare, |