summaryrefslogtreecommitdiffstats
path: root/include/hw/block
diff options
context:
space:
mode:
authorKevin Wolf2016-06-29 17:41:35 +0200
committerKevin Wolf2016-07-13 13:32:27 +0200
commit8c39825218227c0d63709708602d34c4355bad56 (patch)
tree34dd245add610f9df29d03a4482b0b8cd42d079e /include/hw/block
parentcommit: Fix use of error handling policy (diff)
downloadqemu-8c39825218227c0d63709708602d34c4355bad56.tar.gz
qemu-8c39825218227c0d63709708602d34c4355bad56.tar.xz
qemu-8c39825218227c0d63709708602d34c4355bad56.zip
block/qdev: Allow configuring rerror/werror with qdev properties
The rerror/werror policies are implemented in the devices, so that's where they should be configured. In comparison to the old options in -drive, the qdev properties are only added to those devices that actually support them. If the option isn't given (or "auto" is specified), the setting of the BlockBackend is used for compatibility with the old options. For block jobs, "auto" is the same as "enospc". Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include/hw/block')
-rw-r--r--include/hw/block/block.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index 245ac99148..df9d207d81 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -26,6 +26,8 @@ typedef struct BlockConf {
/* geometry, not all devices use this */
uint32_t cyls, heads, secs;
OnOffAuto wce;
+ BlockdevOnError rerror;
+ BlockdevOnError werror;
} BlockConf;
static inline unsigned int get_physical_block_exp(BlockConf *conf)
@@ -58,6 +60,12 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \
DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
+#define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf) \
+ DEFINE_PROP_BLOCKDEV_ON_ERROR("rerror", _state, _conf.rerror, \
+ BLOCKDEV_ON_ERROR_AUTO), \
+ DEFINE_PROP_BLOCKDEV_ON_ERROR("werror", _state, _conf.werror, \
+ BLOCKDEV_ON_ERROR_AUTO)
+
/* Configuration helpers */
void blkconf_serial(BlockConf *conf, char **serial);