mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
block/qdev: Allow configuring WCE with qdev properties
As cache.writeback is a BlockBackend property and as such more related to the guest device than the BlockDriverState, we already removed it from the blockdev-add interface. This patch adds the new way to set it, as a qdev property of the corresponding guest device. For example: -drive if=none,file=test.img,node-name=img -device ide-hd,drive=img,write-cache=off Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
8daea51095
commit
f6166a06ff
7 changed files with 25 additions and 1 deletions
|
@ -25,6 +25,7 @@ typedef struct BlockConf {
|
|||
uint32_t discard_granularity;
|
||||
/* geometry, not all devices use this */
|
||||
uint32_t cyls, heads, secs;
|
||||
OnOffAuto wce;
|
||||
} BlockConf;
|
||||
|
||||
static inline unsigned int get_physical_block_exp(BlockConf *conf)
|
||||
|
@ -49,7 +50,8 @@ 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), \
|
||||
|
@ -63,6 +65,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 */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue