]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
Rename DriveInfo.onerror to on_write_error
authorKevin Wolf <kwolf@redhat.com>
Fri, 27 Nov 2009 12:25:36 +0000 (13:25 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Thu, 3 Dec 2009 17:45:49 +0000 (11:45 -0600)
Either rename variables and functions to refer to write errors (which is what
they actually do) or introduce a parameter to distinguish reads and writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/ide/core.c
hw/scsi-disk.c
hw/virtio-blk.c
sysemu.h
vl.c

index 7b1ff8f9574b0b7b9f778cae98727713893b0311..49bbdcde10be8a613d993c2ca553de02c8691597 100644 (file)
@@ -473,7 +473,7 @@ void ide_dma_error(IDEState *s)
 
 static int ide_handle_write_error(IDEState *s, int error, int op)
 {
-    BlockInterfaceErrorAction action = drive_get_onerror(s->bs);
+    BlockInterfaceErrorAction action = drive_get_on_error(s->bs, 0);
 
     if (action == BLOCK_ERR_IGNORE)
         return 0;
index c802ccdbdb9c4bba7051bc537972c26b75c484d8..67e3008980fcd636dc33681d837263d1654181fe 100644 (file)
@@ -172,7 +172,8 @@ static void scsi_read_data(SCSIDevice *d, uint32_t tag)
 static int scsi_handle_write_error(SCSIDiskReq *r, int error)
 {
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
-    BlockInterfaceErrorAction action = drive_get_onerror(s->qdev.dinfo->bdrv);
+    BlockInterfaceErrorAction action =
+        drive_get_on_error(s->qdev.dinfo->bdrv, 0);
 
     if (action == BLOCK_ERR_IGNORE)
         return 0;
index 42b766fa2c7a0dedb79d2dec4fd10b3fb143a2df..a93d20dfa6f97998694f117448eae731e3eed62d 100644 (file)
@@ -100,7 +100,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
 
 static int virtio_blk_handle_write_error(VirtIOBlockReq *req, int error)
 {
-    BlockInterfaceErrorAction action = drive_get_onerror(req->dev->bs);
+    BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, 0);
     VirtIOBlock *s = req->dev;
 
     if (action == BLOCK_ERR_IGNORE)
index e7819de9a777c863c535ebf59346196789bb8624..c79a019e731a0c0ee7f3d90a2e4f1a0c70ba9349 100644 (file)
--- a/sysemu.h
+++ b/sysemu.h
@@ -180,7 +180,7 @@ typedef struct DriveInfo {
     int bus;
     int unit;
     QemuOpts *opts;
-    BlockInterfaceErrorAction onerror;
+    BlockInterfaceErrorAction on_write_error;
     char serial[BLOCK_SERIAL_STRLEN + 1];
     QTAILQ_ENTRY(DriveInfo) next;
 } DriveInfo;
@@ -197,7 +197,9 @@ extern DriveInfo *drive_get_by_id(const char *id);
 extern int drive_get_max_bus(BlockInterfaceType type);
 extern void drive_uninit(DriveInfo *dinfo);
 extern const char *drive_get_serial(BlockDriverState *bdrv);
-extern BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv);
+
+extern BlockInterfaceErrorAction drive_get_on_error(
+    BlockDriverState *bdrv, int is_read);
 
 BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type);
 
diff --git a/vl.c b/vl.c
index 78a4ec4d905124dfdb90965b31de9a13f88aa534..b0a2e883d4e578d3a9e287e3491b5c2625e9ea8c 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1959,13 +1959,18 @@ const char *drive_get_serial(BlockDriverState *bdrv)
     return "\0";
 }
 
-BlockInterfaceErrorAction drive_get_onerror(BlockDriverState *bdrv)
+BlockInterfaceErrorAction drive_get_on_error(
+    BlockDriverState *bdrv, int is_read)
 {
     DriveInfo *dinfo;
 
+    if (is_read) {
+        return BLOCK_ERR_REPORT;
+    }
+
     QTAILQ_FOREACH(dinfo, &drives, next) {
         if (dinfo->bdrv == bdrv)
-            return dinfo->onerror;
+            return dinfo->on_write_error;
     }
 
     return BLOCK_ERR_STOP_ENOSPC;
@@ -2263,7 +2268,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
     dinfo->type = type;
     dinfo->bus = bus_id;
     dinfo->unit = unit_id;
-    dinfo->onerror = onerror;
+    dinfo->on_write_error = onerror;
     dinfo->opts = opts;
     if (serial)
         strncpy(dinfo->serial, serial, sizeof(serial));