Am 24.07.2012 13:03, schrieb Paolo Bonzini: > Move the common part of IDE/SCSI/virtio error handling to the block > layer. The new function bdrv_error_action subsumes all three of > bdrv_emit_qmp_error_event, vm_stop, bdrv_iostatus_set_err. > > The same scheme will be used for errors in block jobs. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > block.c | 46 ++++++++++++++++++++++++++++++++++++++-------- > block.h | 5 +++-- > hw/ide/core.c | 20 +++++--------------- > hw/scsi-disk.c | 23 +++++++---------------- > hw/virtio-blk.c | 19 +++++-------------- > qemu-tool.c | 6 ++++++ > 6 files changed, 64 insertions(+), 55 deletions(-) > > diff --git a/block.c b/block.c > index 5cd3a4b..333a8fd 100644 > --- a/block.c > +++ b/block.c > @@ -29,6 +29,7 @@ > #include "blockjob.h" > #include "module.h" > #include "qjson.h" > +#include "sysemu.h" > #include "qemu-coroutine.h" > #include "qmp-commands.h" > #include "qemu-timer.h" > @@ -1152,8 +1153,8 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const > BlockDevOps *ops, > } > } > > -void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv, > - BlockErrorAction action, int is_read) > +static void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv, > + BlockErrorAction action, int is_read) > { > QObject *data; > const char *action_str; > @@ -2147,6 +2148,39 @@ BlockdevOnError bdrv_get_on_error(BlockDriverState > *bs, int is_read) > return is_read ? bs->on_read_error : bs->on_write_error; > } > > +BlockErrorAction bdrv_get_error_action(BlockDriverState *bs, int is_read, > int error)
Maybe bool is_read? Kevin