qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Gerd Hoffmann <kraxel@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: kvm-devel <kvm@vger.kernel.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de>,
	Paul Brook <paul@codesourcery.com>
Subject: [Qemu-devel] [PATCH 4/5] [scsi]: Add BSG support for scsi-bus and scsi-disk
Date: Mon, 14 Jun 2010 02:44:38 -0700	[thread overview]
Message-ID: <1276508678-3081-1-git-send-email-nab@linux-iscsi.org> (raw)

From: Nicholas Bellinger <nab@linux-iscsi.org>

This patch updates hw/scsi-bus.c:scsi_bus_legacy_add_drive() to check for the scsi-bsg backstore.

It also updates hw/scsi-disk.c:scsi_disk_initfn() to check for when bdrv_is_bsg() is present and
we need to fail for the fileio backed scsi-disk code.

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
 hw/scsi-bus.c  |    3 ++-
 hw/scsi-disk.c |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 7d80405..b5f5fbb 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -90,7 +90,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, DriveInfo *dinfo, int unit)
     const char *driver;
     DeviceState *dev;
 
-    driver = bdrv_is_sg(dinfo->bdrv) ? "scsi-generic" : "scsi-disk";
+    driver = bdrv_is_bsg(dinfo->bdrv) ? "scsi-bsg" :
+             bdrv_is_sg(dinfo->bdrv) ? "scsi-generic" : "scsi-disk";
     dev = qdev_create(&bus->qbus, driver);
     qdev_prop_set_uint32(dev, "scsi-id", unit);
     qdev_prop_set_drive(dev, "drive", dinfo);
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index fb3c189..290a2e7 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -704,6 +704,10 @@ static int scsi_disk_initfn(SCSIDevice *dev)
         error_report("scsi-disk: unwanted /dev/sg*");
         return -1;
     }
+    if (bdrv_is_bsg(s->bs)) {
+        error_report("scsi-disk: unwanted BSG");
+        return -1;
+    } 
 
     if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
         s->qdev.blocksize = 2048;
-- 
1.5.6.5

                 reply	other threads:[~2010-06-14  9:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1276508678-3081-1-git-send-email-nab@linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=paul@codesourcery.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).