qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 13/19] iostatus: change is_read to a bool
Date: Fri, 28 Sep 2012 17:22:56 +0200	[thread overview]
Message-ID: <1348845782-15073-14-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1348845782-15073-1-git-send-email-pbonzini@redhat.com>

Do this while we are touching this part of the code, before introducing
more uses of "int is_read".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block.c         | 4 ++--
 block.h         | 4 ++--
 blockdev.c      | 2 +-
 hw/ide/core.c   | 2 +-
 hw/ide/pci.c    | 4 ++--
 hw/scsi-disk.c  | 2 +-
 hw/virtio-blk.c | 4 ++--
 7 file modificati, 11 inserzioni(+), 11 rimozioni(-)

diff --git a/block.c b/block.c
index ab2f7e0..85114c5 100644
--- a/block.c
+++ b/block.c
@@ -1387,7 +1387,7 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops,
 }
 
 void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
-                               BlockErrorAction action, int is_read)
+                               BlockErrorAction action, bool is_read)
 {
     QObject *data;
     const char *action_str;
@@ -2338,7 +2338,7 @@ void bdrv_set_on_error(BlockDriverState *bs, BlockdevOnError on_read_error,
     bs->on_write_error = on_write_error;
 }
 
-BlockdevOnError bdrv_get_on_error(BlockDriverState *bs, int is_read)
+BlockdevOnError bdrv_get_on_error(BlockDriverState *bs, bool is_read)
 {
     return is_read ? bs->on_read_error : bs->on_write_error;
 }
diff --git a/block.h b/block.h
index d93cbc3..433721d 100644
--- a/block.h
+++ b/block.h
@@ -109,7 +109,7 @@ void bdrv_iostatus_disable(BlockDriverState *bs);
 bool bdrv_iostatus_is_enabled(const BlockDriverState *bs);
 void bdrv_iostatus_set_err(BlockDriverState *bs, int error);
 void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
-                               BlockErrorAction action, int is_read);
+                               BlockErrorAction action, bool is_read);
 void bdrv_info_print(Monitor *mon, const QObject *data);
 void bdrv_info(Monitor *mon, QObject **ret_data);
 void bdrv_stats_print(Monitor *mon, const QObject *data);
@@ -276,7 +276,7 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
 
 void bdrv_set_on_error(BlockDriverState *bs, BlockdevOnError on_read_error,
                        BlockdevOnError on_write_error);
-BlockdevOnError bdrv_get_on_error(BlockDriverState *bs, int is_read);
+BlockdevOnError bdrv_get_on_error(BlockDriverState *bs, bool is_read);
 int bdrv_is_read_only(BlockDriverState *bs);
 int bdrv_is_sg(BlockDriverState *bs);
 int bdrv_enable_write_cache(BlockDriverState *bs);
diff --git a/blockdev.c b/blockdev.c
index 9fc794f..4a7d2dd 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -238,7 +238,7 @@ static void drive_put_ref_bh_schedule(DriveInfo *dinfo)
     qemu_bh_schedule(s->bh);
 }
 
-static int parse_block_error_action(const char *buf, int is_read)
+static int parse_block_error_action(const char *buf, bool is_read)
 {
     if (!strcmp(buf, "ignore")) {
         return BLOCKDEV_ON_ERROR_IGNORE;
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 2620e87..c03db4a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -556,7 +556,7 @@ void ide_dma_error(IDEState *s)
 
 static int ide_handle_rw_error(IDEState *s, int error, int op)
 {
-    int is_read = (op & BM_STATUS_RETRY_READ);
+    bool is_read = (op & BM_STATUS_RETRY_READ) != 0;
     BlockdevOnError action = bdrv_get_on_error(s->bs, is_read);
 
     if (action == BLOCKDEV_ON_ERROR_IGNORE) {
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 88c0942..644533f 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -188,7 +188,7 @@ static void bmdma_restart_bh(void *opaque)
 {
     BMDMAState *bm = opaque;
     IDEBus *bus = bm->bus;
-    int is_read;
+    bool is_read;
     int error_status;
 
     qemu_bh_delete(bm->bh);
@@ -198,7 +198,7 @@ static void bmdma_restart_bh(void *opaque)
         return;
     }
 
-    is_read = !!(bus->error_status & BM_STATUS_RETRY_READ);
+    is_read = (bus->error_status & BM_STATUS_RETRY_READ) != 0;
 
     /* The error status must be cleared before resubmitting the request: The
      * request may fail again, and this case can only be distinguished if the
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index c295326..2dd99a9 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -386,7 +386,7 @@ static void scsi_read_data(SCSIRequest *req)
  */
 static int scsi_handle_rw_error(SCSIDiskReq *r, int error)
 {
-    int is_read = (r->req.cmd.xfer == SCSI_XFER_FROM_DEV);
+    bool is_read = (r->req.cmd.xfer == SCSI_XFER_FROM_DEV);
     SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);
     BlockdevOnError action = bdrv_get_on_error(s->qdev.conf.bs, is_read);
 
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index f178fa8..1ac2483 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -64,7 +64,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
 }
 
 static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
-    int is_read)
+    bool is_read)
 {
     BlockdevOnError action = bdrv_get_on_error(req->dev->bs, is_read);
     VirtIOBlock *s = req->dev;
@@ -98,7 +98,7 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
     trace_virtio_blk_rw_complete(req, ret);
 
     if (ret) {
-        int is_read = !(ldl_p(&req->out->type) & VIRTIO_BLK_T_OUT);
+        bool is_read = !(ldl_p(&req->out->type) & VIRTIO_BLK_T_OUT);
         if (virtio_blk_handle_rw_error(req, -ret, is_read))
             return;
     }
-- 
1.7.12

  parent reply	other threads:[~2012-09-28 15:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 15:22 [Qemu-devel] [PULL for Kevin 00/19] Block job improvements part 1 Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 01/19] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 02/19] blockdev: rename block_stream_cb to a generic block_job_cb Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 03/19] block: fix documentation of block_job_cancel_sync Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 04/19] block: move job APIs to separate files Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 05/19] block: add block_job_query Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 06/19] qmp: add 'busy' member to BlockJobInfo Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 07/19] block: add support for job pause/resume Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 08/19] qmp: add block-job-pause and block-job-resume Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 09/19] qemu-iotests: add test for pausing a streaming operation Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 10/19] block: rename block_job_complete to block_job_completed Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 11/19] iostatus: rename BlockErrorAction, BlockQMPEventAction Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 12/19] iostatus: move BlockdevOnError declaration to QAPI Paolo Bonzini
2012-09-28 15:22 ` Paolo Bonzini [this message]
2012-09-28 15:22 ` [Qemu-devel] [PATCH 14/19] iostatus: reorganize io error code Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 15/19] block: introduce block job error Paolo Bonzini
2012-09-28 15:22 ` [Qemu-devel] [PATCH 16/19] stream: add on-error argument Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 17/19] blkdebug: process all set_state rules in the old state Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 18/19] qemu-iotests: map underscore to dash in QMP argument names Paolo Bonzini
2012-09-28 15:23 ` [Qemu-devel] [PATCH 19/19] qemu-iotests: add tests for streaming error handling Paolo Bonzini
2012-09-28 15:57 ` [Qemu-devel] [PULL for Kevin 00/19] Block job improvements part 1 Eric Blake
2012-09-28 18:23 ` Kevin Wolf
2012-10-01 13:37   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348845782-15073-14-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).