[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 15/36] qdev: Add "lock-mode" to block device opti
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v8 15/36] qdev: Add "lock-mode" to block device options |
Date: |
Fri, 30 Sep 2016 20:09:45 +0800 |
Signed-off-by: Fam Zheng <address@hidden>
---
hw/core/qdev-properties.c | 10 ++++++++++
include/hw/block/block.h | 1 +
include/hw/qdev-properties.h | 3 +++
3 files changed, 14 insertions(+)
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) \
--
2.7.4
- [Qemu-devel] [PATCH v8 06/36] qemu-io: Add "-L" option for BDRV_O_NO_LOCK, (continued)
- [Qemu-devel] [PATCH v8 06/36] qemu-io: Add "-L" option for BDRV_O_NO_LOCK, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 05/36] raw-posix: Add image locking support, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 08/36] qemu-img: Update documentation of "-L" option, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 07/36] qemu-img: Add "-L" option to sub commands, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 10/36] block: Don't lock drive-backup target image in none mode, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 09/36] qemu-nbd: Add "--no-lock/-L" option, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 11/36] block: Add blk_lock_image, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 12/36] virtio-blk: Apply lock-mode when realize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 13/36] scsi-disk: Apply lock-mode when realize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 14/36] scsi-generic: Apply lock-mode when realize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 15/36] qdev: Add "lock-mode" to block device options,
Fam Zheng <=
- [Qemu-devel] [PATCH v8 16/36] ide: Apply lock-mode when initialize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 17/36] nvme: Apply lock-mode when initialize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 18/36] usb-storage: Apply lock-mode when realize, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 19/36] pflash: Add "lock-mode" property, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 20/36] qemu-iotests: 046: Move version detection out from verify_io, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 21/36] qemu-iotests: 091: Prepare for image lock, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 22/36] qemu-iotests: 030: Disable image locking when checking test image, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 23/36] iotests: 087: Disable image locking in cases where file is shared, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 24/36] iotests: 087: Disable image locking in cases where file is shared, Fam Zheng, 2016/09/30
- [Qemu-devel] [PATCH v8 25/36] iotests: 130: Check image info locklessly, Fam Zheng, 2016/09/30