From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device
Date: Mon, 6 Jun 2011 18:04:17 +0200 [thread overview]
Message-ID: <1307376262-1255-9-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1307376262-1255-1-git-send-email-pbonzini@redhat.com>
This introduces a device that dispatches SCSI requests according to the
"target" field of a hierarchical LUN. The device does not have to do
any processing: requests are always forwarded to a target.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Makefile.objs | 2 +-
hw/scsi-luns.c | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletions(-)
create mode 100644 hw/scsi-luns.c
diff --git a/Makefile.objs b/Makefile.objs
index 90838f6..90940d3 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -85,7 +85,7 @@ common-obj-$(CONFIG_MAX111X) += max111x.o
common-obj-$(CONFIG_DS1338) += ds1338.o
common-obj-y += i2c.o smbus.o smbus_eeprom.o
common-obj-y += eeprom93xx.o
-common-obj-y += scsi-disk.o cdrom.o
+common-obj-y += scsi-disk.o cdrom.o scsi-luns.o
common-obj-y += scsi-generic.o scsi-bus.o
common-obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o
common-obj-y += usb-serial.o usb-net.o usb-bus.o usb-desc.o
diff --git a/hw/scsi-luns.c b/hw/scsi-luns.c
new file mode 100644
index 0000000..699e3c1
--- /dev/null
+++ b/hw/scsi-luns.c
@@ -0,0 +1,42 @@
+/*
+ * SCSI Device emulation
+ *
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>.
+ *
+ * This code is licenced under the LGPL.
+ */
+
+#include "qemu-common.h"
+#include "qemu-error.h"
+#include "scsi.h"
+#include "sysemu.h"
+
+static struct SCSIBusOps path_scsi_ops = {
+ .decode_lun = scsi_decode_target_from_lun
+};
+
+static int scsi_path_initfn(SCSIDevice *s)
+{
+ s->children = qemu_mallocz(sizeof(SCSIBus));
+ scsi_bus_new(s->children, &s->qdev, 1, MAX_SCSI_DEVS,
+ &path_scsi_ops);
+ return 0;
+}
+
+static SCSIDeviceInfo scsi_path_info = {
+ .qdev.name = "scsi-path",
+ .qdev.desc = "SCSI initiator device connected to multiple targets",
+ .qdev.size = sizeof(SCSIDevice),
+ .init = scsi_path_initfn,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_END_OF_LIST(),
+ },
+};
+
+static void scsi_luns_register_devices(void)
+{
+ scsi_qdev_register(&scsi_path_info);
+}
+device_init(scsi_luns_register_devices)
--
1.7.4.4
next prev parent reply other threads:[~2011-06-06 16:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 16:04 [Qemu-devel] [RFC PATCH v2 00/13] support hierarchical LUNs Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 01/13] scsi: cleanup reset and destroy callbacks Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 02/13] scsi: support parsing of SAM logical unit numbers Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 03/13] scsi: add initiator field to SCSIRequest Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 04/13] scsi: let a SCSIDevice have children devices Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 05/13] scsi: let the bus pick a LUN for the child device Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 06/13] scsi-generic: fix passthrough of devices with LUN != 0 Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 07/13] scsi: add walking of hierarchical LUNs Paolo Bonzini
2011-06-06 16:04 ` Paolo Bonzini [this message]
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 09/13] scsi: introduce the scsi-target device Paolo Bonzini
2011-06-07 8:09 ` Stefan Hajnoczi
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 10/13] scsi: include bus and device levels Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 11/13] qdev: introduce automatic creation of buses Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 12/13] scsi: create scsi-path and scsi-target devices automatically Paolo Bonzini
2011-06-06 16:04 ` [Qemu-devel] [RFC PATCH v2 13/13] scsi: delete handling of REPORT LUNS and unknown LUNs outside scsi-target Paolo Bonzini
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=1307376262-1255-9-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.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).