Message ID | 1475237406-26917-16-git-send-email-famz@redhat.com |
---|---|
State | New |
Headers | show |
On 30.09.2016 14:09, Fam Zheng wrote: > Signed-off-by: Fam Zheng <famz@redhat.com> > --- > hw/core/qdev-properties.c | 10 ++++++++++ > include/hw/block/block.h | 1 + > include/hw/qdev-properties.h | 3 +++ > 3 files changed, 14 insertions(+) Why don't you add _conf.lock_mode in this very patch (instead of patch 3) and pull it in front of patch 12? Setting the mode won't do anything until it's implemented for the various block devices, but I don't think that's a bad thing. Max
On Sat, 10/22 02:11, Max Reitz wrote: > On 30.09.2016 14:09, Fam Zheng wrote: > > Signed-off-by: Fam Zheng <famz@redhat.com> > > --- > > hw/core/qdev-properties.c | 10 ++++++++++ > > include/hw/block/block.h | 1 + > > include/hw/qdev-properties.h | 3 +++ > > 3 files changed, 14 insertions(+) > > Why don't you add _conf.lock_mode in this very patch (instead of patch > 3) and pull it in front of patch 12? Setting the mode won't do anything > until it's implemented for the various block devices, but I don't think > that's a bad thing. Sounds good! Fam
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 311af6d..829b143 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -552,6 +552,16 @@ PropertyInfo qdev_prop_blockdev_on_error = { .set = set_enum, }; +/* --- Block image lock mode --- */ + +PropertyInfo qdev_prop_lock_mode = { + .name = "ImageLockMode", + .description = "Image lock mode for drive (auto/shared/exclusive/nolock)", + .enum_table = ImageLockMode_lookup, + .get = get_enum, + .set = set_enum, +}; + /* --- BIOS CHS translation */ QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int)); diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 8c04469..520d142 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -47,6 +47,7 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) #define DEFINE_BLOCK_PROPERTIES(_state, _conf) \ DEFINE_PROP_DRIVE("drive", _state, _conf.blk), \ + DEFINE_PROP_LOCK_MODE("lock-mode", _state, _conf.lock_mode), \ DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \ _conf.logical_block_size), \ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \ diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 2a9d2f9..1bce8ee 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -30,6 +30,7 @@ extern PropertyInfo qdev_prop_pci_devfn; extern PropertyInfo qdev_prop_blocksize; extern PropertyInfo qdev_prop_pci_host_devaddr; extern PropertyInfo qdev_prop_arraylen; +extern PropertyInfo qdev_prop_lock_mode; #define DEFINE_PROP(_name, _state, _field, _prop, _type) { \ .name = (_name), \ @@ -155,6 +156,8 @@ extern PropertyInfo qdev_prop_arraylen; DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, NICPeers) #define DEFINE_PROP_DRIVE(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) +#define DEFINE_PROP_LOCK_MODE(_n, _s, _f) \ + DEFINE_PROP(_n, _s, _f, qdev_prop_lock_mode, ImageLockMode) #define DEFINE_PROP_MACADDR(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr) #define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \
Signed-off-by: Fam Zheng <famz@redhat.com> --- hw/core/qdev-properties.c | 10 ++++++++++ include/hw/block/block.h | 1 + include/hw/qdev-properties.h | 3 +++ 3 files changed, 14 insertions(+)