From patchwork Tue Jul 24 11:03:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 172884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 185CC2C007B for ; Tue, 24 Jul 2012 22:49:46 +1000 (EST) Received: from localhost ([::1]:41280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stcwf-00085b-4W for incoming@patchwork.ozlabs.org; Tue, 24 Jul 2012 07:06:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StcvO-0005qo-3K for qemu-devel@nongnu.org; Tue, 24 Jul 2012 07:05:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StcvH-0005Fm-PH for qemu-devel@nongnu.org; Tue, 24 Jul 2012 07:05:09 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:36778) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StcvH-00058R-Ir for qemu-devel@nongnu.org; Tue, 24 Jul 2012 07:05:03 -0400 Received: by mail-yw0-f45.google.com with SMTP id p34so6575216yhp.4 for ; Tue, 24 Jul 2012 04:05:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=YgqplMFbRMQkRbmckJVlq1DAPWKAPa+4S161vauyU7g=; b=juPxs+ljxlYLucwYgW1BJLzmyeW/cM8I9MGojY+otuFQ3JIFCHdnrUSLqfITm8A42f /QcBPT1QUk1T0bHzgbx+VrdHsIgPr6knZrnsoPvbE5j7k2bVex+JIHRAHgg/krGXucMJ AaU/+8VmbE7H/Ox9a7kqhWnAocaY9iCVPmA4K3n6vc/NMvQDObSkxwk6ReVS2At0GxpQ nQqJKYFR1ipjwcvIO9dAr9JBYwPhKNxEh+5wE4IVofdPy48dXaS1eBGiwyZ+sdi11FgB Dwq9wdQ9aHzSxvMETaMvE6TN0n6BFCWMF5FVjlcHFtJM1/42+UCtkA4o2oAmVzhrIBuU LbKQ== Received: by 10.42.38.200 with SMTP id d8mr9199215ice.19.1343127903106; Tue, 24 Jul 2012 04:05:03 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-189-113.ip51.fastwebnet.it. [93.34.189.113]) by mx.google.com with ESMTPS id if4sm1752561igc.10.2012.07.24.04.05.00 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 04:05:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 24 Jul 2012 13:03:47 +0200 Message-Id: <1343127865-16608-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343127865-16608-1-git-send-email-pbonzini@redhat.com> References: <1343127865-16608-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.45 Cc: kwolf@redhat.com, jcody@redhat.com, eblake@redhat.com, stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH 09/47] block: rename BlockErrorAction, BlockQMPEventAction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We want to remove knowledge of BLOCK_ERR_STOP_ENOSPC from drivers; drivers should only be told whether to stop/report/ignore the error. On the other hand, we want to keep using the nicer BlockErrorAction name in the drivers. So rename the enums, while leaving aside the names of the enum values for now. Signed-off-by: Paolo Bonzini --- block.c | 8 ++++---- block.h | 12 ++++++------ block_int.h | 2 +- hw/ide/core.c | 2 +- hw/scsi-disk.c | 2 +- hw/virtio-blk.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/block.c b/block.c index 41e329a..7660992 100644 --- a/block.c +++ b/block.c @@ -1153,7 +1153,7 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops, } void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv, - BlockQMPEventAction action, int is_read) + BlockErrorAction action, int is_read) { QObject *data; const char *action_str; @@ -2135,14 +2135,14 @@ void bdrv_set_io_limits(BlockDriverState *bs, bs->io_limits_enabled = bdrv_io_limits_enabled(bs); } -void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error, - BlockErrorAction on_write_error) +void bdrv_set_on_error(BlockDriverState *bs, BlockdevOnError on_read_error, + BlockdevOnError on_write_error) { bs->on_read_error = on_read_error; bs->on_write_error = on_write_error; } -BlockErrorAction bdrv_get_on_error(BlockDriverState *bs, int is_read) +BlockdevOnError bdrv_get_on_error(BlockDriverState *bs, int is_read) { return is_read ? bs->on_read_error : bs->on_write_error; } diff --git a/block.h b/block.h index 9b5fca4..5cfa137 100644 --- a/block.h +++ b/block.h @@ -91,11 +91,11 @@ typedef struct BlockDevOps { typedef enum { BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC, BLOCK_ERR_STOP_ANY -} BlockErrorAction; +} BlockdevOnError; typedef enum { BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP -} BlockQMPEventAction; +} BlockErrorAction; void bdrv_iostatus_enable(BlockDriverState *bs); void bdrv_iostatus_reset(BlockDriverState *bs); @@ -103,7 +103,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, - BlockQMPEventAction action, int is_read); + BlockErrorAction action, int 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); @@ -259,9 +259,9 @@ int bdrv_has_zero_init(BlockDriverState *bs); int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum); -void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error, - BlockErrorAction on_write_error); -BlockErrorAction bdrv_get_on_error(BlockDriverState *bs, int is_read); +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); int bdrv_is_read_only(BlockDriverState *bs); int bdrv_is_sg(BlockDriverState *bs); int bdrv_enable_write_cache(BlockDriverState *bs); diff --git a/block_int.h b/block_int.h index d4642fb..4cc173d 100644 --- a/block_int.h +++ b/block_int.h @@ -253,7 +253,7 @@ struct BlockDriverState { /* NOTE: the following infos are only hints for real hardware drivers. They are not used by the block driver */ - BlockErrorAction on_read_error, on_write_error; + BlockdevOnError on_read_error, on_write_error; bool iostatus_enabled; BlockDeviceIoStatus iostatus; char device_name[32]; diff --git a/hw/ide/core.c b/hw/ide/core.c index d65ef3d..4823e92 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -559,7 +559,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); - BlockErrorAction action = bdrv_get_on_error(s->bs, is_read); + BlockdevOnError action = bdrv_get_on_error(s->bs, is_read); if (action == BLOCK_ERR_IGNORE) { bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_IGNORE, is_read); diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 525816c..40804a6 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -392,7 +392,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error) { int is_read = (r->req.cmd.xfer == SCSI_XFER_FROM_DEV); SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); - BlockErrorAction action = bdrv_get_on_error(s->qdev.conf.bs, is_read); + BlockdevOnError action = bdrv_get_on_error(s->qdev.conf.bs, is_read); if (action == BLOCK_ERR_IGNORE) { bdrv_emit_qmp_error_event(s->qdev.conf.bs, BDRV_ACTION_IGNORE, is_read); diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index f21757e..a70fbe4 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -66,7 +66,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) { - BlockErrorAction action = bdrv_get_on_error(req->dev->bs, is_read); + BlockdevOnError action = bdrv_get_on_error(req->dev->bs, is_read); VirtIOBlock *s = req->dev; if (action == BLOCK_ERR_IGNORE) {