From patchwork Wed Oct 12 14:24:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 119240 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B8BD8B6EE8 for ; Thu, 13 Oct 2011 02:31:56 +1100 (EST) Received: from localhost ([::1]:48624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDzk9-00069j-87 for incoming@patchwork.ozlabs.org; Wed, 12 Oct 2011 10:25:13 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDzja-0004hW-A2 for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:24:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDzjY-0005Ux-Qt for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:24:38 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:33061) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDzjY-0005SA-M0 for qemu-devel@nongnu.org; Wed, 12 Oct 2011 10:24:36 -0400 Received: by mail-ww0-f53.google.com with SMTP id 14so100353wwg.10 for ; Wed, 12 Oct 2011 07:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=l4zIltmQMB35Fz8s676mLGCoCP+GOnOlQoZpbr9+7jQ=; b=YHgr8CGgotzZrE9dlBevjpKm7k7BWmkUtMrRBa1/4FzyzflFVL6Ha0PMPUlF5l8lBB 2Ewo3h0NpGT8Ae2a9k5oIlRshHljpTiw9ozQsQiHN1g62BymNivwXw6LF/44brULaElE 0b9CZv5ATeygWngHUXhK7DPt+XcTYIgLW6QuQ= Received: by 10.216.229.86 with SMTP id g64mr2554136weq.42.1318429476328; Wed, 12 Oct 2011 07:24:36 -0700 (PDT) Received: from localhost.localdomain (93-34-218-143.ip51.fastwebnet.it. [93.34.218.143]) by mx.google.com with ESMTPS id j18sm303508wbo.6.2011.10.12.07.24.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Oct 2011 07:24:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Oct 2011 16:24:08 +0200 Message-Id: <1318429451-9306-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1318429451-9306-1-git-send-email-pbonzini@redhat.com> References: <1318429451-9306-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Subject: [Qemu-devel] [PATCH 07/10] scsi: make reqops const 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 Also delete a stale occurrence of SCSIReqOps inside SCSIDeviceInfo. Signed-off-by: Paolo Bonzini --- hw/scsi-bus.c | 10 +++++----- hw/scsi-disk.c | 2 +- hw/scsi-generic.c | 2 +- hw/scsi.h | 7 +++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index bdd6e94..252e903 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -160,7 +160,7 @@ static int32_t scsi_invalid_command(SCSIRequest *req, uint8_t *buf) return 0; } -struct SCSIReqOps reqops_invalid_opcode = { +const struct SCSIReqOps reqops_invalid_opcode = { .size = sizeof(SCSIRequest), .send_command = scsi_invalid_command }; @@ -178,7 +178,7 @@ static int32_t scsi_unit_attention(SCSIRequest *req, uint8_t *buf) return 0; } -struct SCSIReqOps reqops_unit_attention = { +const struct SCSIReqOps reqops_unit_attention = { .size = sizeof(SCSIRequest), .send_command = scsi_unit_attention }; @@ -386,7 +386,7 @@ static uint8_t *scsi_target_get_buf(SCSIRequest *req) return r->buf; } -struct SCSIReqOps reqops_target_command = { +const struct SCSIReqOps reqops_target_command = { .size = sizeof(SCSITargetReq), .send_command = scsi_target_send_command, .read_data = scsi_target_read_data, @@ -394,8 +394,8 @@ struct SCSIReqOps reqops_target_command = { }; -SCSIRequest *scsi_req_alloc(SCSIReqOps *reqops, SCSIDevice *d, uint32_t tag, - uint32_t lun, void *hba_private) +SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, + uint32_t tag, uint32_t lun, void *hba_private) { SCSIRequest *req; diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index a4daa29..6c1d5a2 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1583,7 +1583,7 @@ static int scsi_disk_initfn(SCSIDevice *dev) } } -static SCSIReqOps scsi_disk_reqops = { +static const SCSIReqOps scsi_disk_reqops = { .size = sizeof(SCSIDiskReq), .free_req = scsi_free_request, .send_command = scsi_send_command, diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index 7b291ec..9c9f64a 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -432,7 +432,7 @@ static int scsi_generic_initfn(SCSIDevice *s) return 0; } -static SCSIReqOps scsi_generic_req_ops = { +static const SCSIReqOps scsi_generic_req_ops = { .size = sizeof(SCSIGenericReq), .free_req = scsi_free_request, .send_command = scsi_send_command, diff --git a/hw/scsi.h b/hw/scsi.h index c8649cf..832682e 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -41,7 +41,7 @@ struct SCSICommand { struct SCSIRequest { SCSIBus *bus; SCSIDevice *dev; - SCSIReqOps *ops; + const SCSIReqOps *ops; uint32_t refcount; uint32_t tag; uint32_t lun; @@ -95,7 +95,6 @@ struct SCSIDeviceInfo { SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun, void *hba_private); void (*unit_attention_reported)(SCSIDevice *s); - SCSIReqOps reqops; }; struct SCSIBusInfo { @@ -175,8 +174,8 @@ extern const struct SCSISense sense_code_DEVICE_INTERNAL_RESET; int scsi_sense_valid(SCSISense sense); -SCSIRequest *scsi_req_alloc(SCSIReqOps *reqops, SCSIDevice *d, uint32_t tag, - uint32_t lun, void *hba_private); +SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, + uint32_t tag, uint32_t lun, void *hba_private); SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, void *hba_private); int32_t scsi_req_enqueue(SCSIRequest *req);