From patchwork Mon Jun 14 09:44:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 105907 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5E9iNmc029234 for ; Mon, 14 Jun 2010 09:44:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755922Ab0FNJoO (ORCPT ); Mon, 14 Jun 2010 05:44:14 -0400 Received: from smtp102.sbc.mail.gq1.yahoo.com ([67.195.15.61]:40119 "HELO smtp102.sbc.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755898Ab0FNJoN (ORCPT ); Mon, 14 Jun 2010 05:44:13 -0400 Received: (qmail 70453 invoked from network); 14 Jun 2010 09:44:11 -0000 Received: from adsl-70-231-239-201.dsl.snfc21.sbcglobal.net (nab@70.231.239.201 with login) by smtp102.sbc.mail.gq1.yahoo.com with SMTP; 14 Jun 2010 02:44:11 -0700 PDT X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: 4VwP8bwVM1kgXbl0r2M3ykfRhLQAmAamW6gJsQZ6OkB4sOv0lrjHh_YyJuN2crVY3P_RN9O.nu9lPGo91.u509uAOLw0N4KCMcGJC3gG.hMuZUDCVwe1ecTF.CKibUXTn7ebGAVs_uYfkfz9VNDOrml4g9clwQPyO7Z4AZW8qdLuFY.LHZliIOBMEJXIiePOiumJZW6InyB_ANyVyxl8Qo7TM.MSnpSlf4vBRgpVdgX2.nvMcAfP08KFjogNapiwacPHkok2lDc9Wq.FEyLOgq8HcaGhNiIuI6N0E8MqZjqeB.lFDGCSCbaZdUasi67WM9p9C0qe7xJj1YcKQbE64ZhmWKZIoB3MsFngKvBSUIUoQg-- X-Yahoo-Newman-Property: ymail-3 From: "Nicholas A. Bellinger" To: Gerd Hoffmann , Kevin Wolf , FUJITA Tomonori Cc: Hannes Reinecke , Paul Brook , Christoph Hellwig , kvm-devel , qemu-devel , Nicholas Bellinger Subject: [PATCH 4/5] [scsi]: Add BSG support for scsi-bus and scsi-disk Date: Mon, 14 Jun 2010 02:44:38 -0700 Message-Id: <1276508678-3081-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.5.6.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 14 Jun 2010 09:44:24 +0000 (UTC) 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;