diff options
author | Stefan Weil <sw@weilnetz.de> | 2013-01-17 21:45:24 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-01-25 18:18:35 +0100 |
commit | 02582abd48aa3d860015e9a8fcd0d7ec1c34ec62 (patch) | |
tree | c943fd4b33d7a1fec2854086c00bbd29f7617159 /blockdev.c | |
parent | 884fea4e87fbc6daf4e6df618bb3cadc188dcc6b (diff) | |
download | qemu-02582abd48aa3d860015e9a8fcd0d7ec1c34ec62.zip qemu-02582abd48aa3d860015e9a8fcd0d7ec1c34ec62.tar.gz qemu-02582abd48aa3d860015e9a8fcd0d7ec1c34ec62.tar.bz2 |
block: Add special error code for wrong format
The block drivers need a special error code for "wrong format".
From the available error codes EMEDIUMTYPE fits best.
It is not available on all platforms, so a definition in
qemu-common.h and a specific error report are needed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -617,8 +617,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type) ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv); if (ret < 0) { - error_report("could not open disk image %s: %s", - file, strerror(-ret)); + if (ret == -EMEDIUMTYPE) { + error_report("could not open disk image %s: not in %s format", + file, drv->format_name); + } else { + error_report("could not open disk image %s: %s", + file, strerror(-ret)); + } goto err; } |