aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2010-06-02 18:55:17 +0200
committerKevin Wolf <kwolf@redhat.com>2010-06-15 09:41:59 +0200
commitabd7f68d081ef5adb425f659c7449149987bf89e (patch)
tree0bb8f33deaa33cc945b69ef7ba549b07babacb06 /blockdev.c
parent2063392ae5d00a9ea13039f971e2b9e61bd68dbc (diff)
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 <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c17
1 files changed, 2 insertions, 15 deletions
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: