From abd7f68d081ef5adb425f659c7449149987bf89e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 2 Jun 2010 18:55:17 +0200 Subject: block: Move error actions from DriveInfo to BlockDriverState That's where they belong semantically (block device host part), even though the actions are actually executed by guest device code. Signed-off-by: Markus Armbruster Signed-off-by: Kevin Wolf --- blockdev.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index dbeef09ceb..b5570f403f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -90,19 +90,6 @@ const char *drive_get_serial(BlockDriverState *bdrv) return "\0"; } -BlockInterfaceErrorAction drive_get_on_error( - BlockDriverState *bdrv, int is_read) -{ - DriveInfo *dinfo; - - QTAILQ_FOREACH(dinfo, &drives, next) { - if (dinfo->bdrv == bdrv) - return is_read ? dinfo->on_read_error : dinfo->on_write_error; - } - - return is_read ? BLOCK_ERR_REPORT : BLOCK_ERR_STOP_ENOSPC; -} - static void bdrv_format_print(void *opaque, const char *name) { fprintf(stderr, " %s", name); @@ -418,13 +405,13 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) dinfo->type = type; dinfo->bus = bus_id; dinfo->unit = unit_id; - dinfo->on_read_error = on_read_error; - dinfo->on_write_error = on_write_error; dinfo->opts = opts; if (serial) strncpy(dinfo->serial, serial, sizeof(dinfo->serial) - 1); QTAILQ_INSERT_TAIL(&drives, dinfo, next); + bdrv_set_on_error(dinfo->bdrv, on_read_error, on_write_error); + switch(type) { case IF_IDE: case IF_SCSI: -- cgit v1.2.1