All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Cong Meng <mc@linux.vnet.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <anthony@codemonkey.ws>
Cc: stefanha@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	zwanp@cn.ibm.com, Rusty Russell <rusty@rustcorp.com.au>,
	linuxram@us.ibm.com, senwang@linux.vnet.ibm.com,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] [PATCH 1/2] scsi bus: introduce hotplug() and hot_unplug() interfaces for SCSI bus
Date: Wed, 20 Jun 2012 15:10:06 +0200	[thread overview]
Message-ID: <4FE1CBAE.5010503@suse.de> (raw)
In-Reply-To: <287bf70a546a1ce51a6f3405ba620daaf284bdfe.1340022196.git.mc@linux.vnet.ibm.com>

Am 20.06.2012 08:47, schrieb Cong Meng:
> Add two interfaces hotplug() and hot_unplug() to scsi bus info.
> The embody scsi bus can implement these two interfaces to signal the HBA driver
> of guest kernel to add/remove the scsi device in question.
> 
> Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
> Signed-off-by: Sen Wang <senwang@linux.vnet.ibm.com>
> ---
>  hw/scsi-bus.c |   16 +++++++++++++++-
>  hw/scsi.h     |    2 ++
>  2 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> index dbdb99c..cc3ec75 100644
> --- a/hw/scsi-bus.c
> +++ b/hw/scsi-bus.c
> @@ -177,6 +177,10 @@ static int scsi_qdev_init(DeviceState *qdev)
>                                                           dev);
>      }
>  
> +    if (bus->info->hotplug) {
> +	bus->info->hotplug(bus, dev);

Tab.

> +    }
> +
>  err:
>      return rc;
>  }
> @@ -1539,6 +1543,16 @@ static int get_scsi_requests(QEMUFile *f, void *pv, size_t size)
>      return 0;
>  }
>  
> +static int scsi_qdev_unplug(DeviceState *qdev)
> +{
> +    SCSIDevice *dev = SCSI_DEVICE(qdev);
> +    SCSIBus *bus = DO_UPCAST(SCSIBus, qbus, dev->qdev.parent_bus);

Since the tabs need to be fixed anyway, I would suggest to avoid using
DO_UPCAST() with QOM types:

SCSIBus *bus = SCSI_BUS(qdev->parent_bus);

Also I'd like to raise the question towards Paolo and Anthony whether we
might want to start naming new functions like this one
scsi_device_unplug() to avoid the "qdev"? In this case sticking to
"qdev" provides symmetry so there's good reasons for both approaches.

> +
> +    if (bus->info->hot_unplug)
> +	bus->info->hot_unplug(bus, dev);

Tab. It seems your editor converts all 8-space indents, please check the
second patch.

Otherwise looks okay from my side.

Andreas

> +    return qdev_simple_unplug_cb(qdev);
> +}
> +
>  const VMStateInfo vmstate_info_scsi_requests = {
>      .name = "scsi-requests",
>      .get  = get_scsi_requests,
> @@ -1575,7 +1589,7 @@ static void scsi_device_class_init(ObjectClass *klass, void *data)
>      DeviceClass *k = DEVICE_CLASS(klass);
>      k->bus_info = &scsi_bus_info;
>      k->init     = scsi_qdev_init;
> -    k->unplug   = qdev_simple_unplug_cb;
> +    k->unplug   = scsi_qdev_unplug;
>      k->exit     = scsi_qdev_exit;
>  }
>  
> diff --git a/hw/scsi.h b/hw/scsi.h
> index 2eb66f7..5768071 100644
> --- a/hw/scsi.h
> +++ b/hw/scsi.h
> @@ -130,6 +130,8 @@ struct SCSIBusInfo {
>      void (*transfer_data)(SCSIRequest *req, uint32_t arg);
>      void (*complete)(SCSIRequest *req, uint32_t arg, size_t resid);
>      void (*cancel)(SCSIRequest *req);
> +    void (*hotplug)(SCSIBus *bus, SCSIDevice *dev);
> +    void (*hot_unplug)(SCSIBus *bus, SCSIDevice *dev);
>      QEMUSGList *(*get_sg_list)(SCSIRequest *req);
>  
>      void (*save_request)(QEMUFile *f, SCSIRequest *req);

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-06-20 13:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20  6:47 [Qemu-devel] [PATCH 0/2] Hotplug support for virtio-scsi Cong Meng
2012-06-20  6:47 ` [PATCH 1/2] scsi bus: introduce hotplug() and hot_unplug() interfaces for SCSI bus Cong Meng
2012-06-20  6:47 ` [Qemu-devel] " Cong Meng
2012-06-20 13:10   ` Andreas Färber [this message]
2012-06-20 13:10   ` Andreas Färber
2012-06-20  6:47 ` [Qemu-devel] [PATCH 2/2] virtio-scsi: Implement hotplug support for virtio-scsi Cong Meng
2012-06-21 10:56   ` Stefan Hajnoczi
2012-06-21 10:56     ` Stefan Hajnoczi
2012-06-25  7:51     ` mc
2012-06-25  9:10       ` Stefan Hajnoczi
2012-06-20  6:47 ` Cong Meng

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=4FE1CBAE.5010503@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=linuxram@us.ibm.com \
    --cc=mc@linux.vnet.ibm.com \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    --cc=senwang@linux.vnet.ibm.com \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zwanp@cn.ibm.com \
    /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.