On 2013年11月26日 01:13, Paolo Bonzini wrote:
Il 22/11/2013 06:24, Fam Zheng ha scritto:
+void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason)
+{
+ BdrvOpBlocker *blocker;
+ assert(op >=0 && op < BLOCK_OP_TYPE_MAX);
+
+ blocker = g_malloc0(sizeof(BdrvOpBlocker));
+ blocker->reason = reason;
+ QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list);
+}
+
+void bdrv_op_unblock(BlockDriverState *bs, BlockOpType op, Error *reason)
What about making BlockOpType a bitmask, and having bdrv_op_{,un}block
take multiple ORed BlockOpTypes?
bdrv_op_{,un}block_all then are not necessary, you only need a
BLOCK_OPERATION_ALL value.
Bitmap is not enough, at least it should be an array. For example when
we enable multiple block jobs, there're two stoppers for drive_del, right?
And a bool or int is not as friendly as an error message, because when
an operation is blocked we can't print a specific reason when we don't
have this information at all. So let's be consistent with migration
blockers.
Fam