summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-03-15 17:27:00 +0100
committerKevin Wolf <kwolf@redhat.com>2010-04-23 16:08:46 +0200
commit08073a0e4d87f53d760f1148a6be55fe540518af (patch)
tree9c3d6512caa4ffd0366ca6fe6231042b3e89e943 /block.c
parent4d24cfc7cb3dd266f25212d56d3ab489a7209dc8 (diff)
downloadqemu-08073a0e4d87f53d760f1148a6be55fe540518af.tar.gz
qemu-08073a0e4d87f53d760f1148a6be55fe540518af.tar.bz2
qemu-08073a0e4d87f53d760f1148a6be55fe540518af.zip
blkdebug: Add events and rules
Block drivers can trigger a blkdebug event whenever they reach a place where it could be useful to inject an error for testing/debugging purposes. Rules are read from a blkdebug config file and describe which action is taken when an event is triggered. For now this is only injecting an error (with a few options) or changing the state (which is an integer). Rules can be declared to be active only in a specific state; this way later rules can distiguish on which path we came to trigger their event. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/block.c b/block.c
index 0881c93cf9..9351aa3062 100644
--- a/block.c
+++ b/block.c
@@ -1535,6 +1535,18 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
return drv->bdrv_load_vmstate(bs, buf, pos, size);
}
+void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (!drv || !drv->bdrv_debug_event) {
+ return;
+ }
+
+ return drv->bdrv_debug_event(bs, event);
+
+}
+
/**************************************************************/
/* handling of snapshots */