mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
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>
This commit is contained in:
committed by
Kevin Wolf
parent
2063392ae5
commit
abd7f68d08
17
blockdev.c
17
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:
|
||||
|
||||
Reference in New Issue
Block a user