All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] scsi: add unrealize method for SCSI devices
Date: Wed,  7 Feb 2018 17:36:21 +0100	[thread overview]
Message-ID: <20180207163622.29935-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20180207163622.29935-1-pbonzini@redhat.com>

The next patch will introduce a different unrealize implementation
for scsi-block.  Compared to the code before commit fb7b5c0df6
("scsi: devirtualize unrealize of SCSI devices", 2014-10-31), the
common code for all SCSI devices is kept in scsi-bus.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-bus.c     | 4 ++++
 include/hw/scsi/scsi.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 05e501efd3..a0790438f0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -212,12 +212,16 @@ static void scsi_qdev_realize(DeviceState *qdev, Error **errp)
 static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
 {
     SCSIDevice *dev = SCSI_DEVICE(qdev);
+    SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(dev);
 
     if (dev->vmsentry) {
         qemu_del_vm_change_state_handler(dev->vmsentry);
     }
 
     scsi_device_purge_requests(dev, SENSE_CODE(NO_SENSE));
+    if (sc->unrealize) {
+        sc->unrealize(dev, errp);
+    }
     blockdev_mark_auto_del(dev->conf.blk);
 }
 
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index 802a647cdc..569a4b9d14 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -59,6 +59,7 @@ struct SCSIRequest {
 typedef struct SCSIDeviceClass {
     DeviceClass parent_class;
     void (*realize)(SCSIDevice *dev, Error **errp);
+    void (*unrealize)(SCSIDevice *dev, Error **errp);
     int (*parse_cdb)(SCSIDevice *dev, SCSICommand *cmd, uint8_t *buf,
                      void *hba_private);
     SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,
-- 
2.14.3

  reply	other threads:[~2018-02-07 16:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 16:36 [Qemu-devel] [PATCH 0/2] scsi: add block job opblockers for scsi-block Paolo Bonzini
2018-02-07 16:36 ` Paolo Bonzini [this message]
2018-02-08  1:35   ` [Qemu-devel] [PATCH 1/2] scsi: add unrealize method for SCSI devices Fam Zheng
2018-02-07 16:36 ` [Qemu-devel] [PATCH 2/2] scsi: add block job opblockers for scsi-block Paolo Bonzini
2018-02-08  1:35   ` Fam Zheng
2018-02-08 10:42     ` Paolo Bonzini
2018-02-12 13:52       ` Kevin Wolf
2018-02-12 14:00         ` Paolo Bonzini
2018-02-12 14:30           ` Kevin Wolf
2018-02-12 14:32             ` Paolo Bonzini
2018-02-12 14:48               ` Kevin Wolf
2018-02-12 14:50                 ` Paolo Bonzini
2018-03-12 11:10                   ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
2018-03-12 11:58                     ` Kevin Wolf
2018-04-05 11:59                       ` Paolo Bonzini
2018-04-05 12:43                         ` Kevin Wolf

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=20180207163622.29935-2-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.