summaryrefslogtreecommitdiff
path: root/include/hw/block/block.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/block/block.h')
-rw-r--r--include/hw/block/block.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index 984660efd..df9d207d8 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -8,8 +8,8 @@
* later. See the COPYING file in the top-level directory.
*/
-#ifndef HW_BLOCK_COMMON_H
-#define HW_BLOCK_COMMON_H
+#ifndef HW_BLOCK_H
+#define HW_BLOCK_H
#include "qemu-common.h"
@@ -25,6 +25,9 @@ typedef struct BlockConf {
uint32_t discard_granularity;
/* 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)
@@ -49,13 +52,20 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \
DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
DEFINE_PROP_UINT32("discard_granularity", _state, \
- _conf.discard_granularity, -1)
+ _conf.discard_granularity, -1), \
+ DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, ON_OFF_AUTO_AUTO)
#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
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);
@@ -63,6 +73,7 @@ void blkconf_geometry(BlockConf *conf, int *trans,
unsigned cyls_max, unsigned heads_max, unsigned secs_max,
Error **errp);
void blkconf_blocksizes(BlockConf *conf);
+void blkconf_apply_backend_options(BlockConf *conf);
/* Hard disk geometry */