[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device |
Date: |
Mon, 6 Jun 2011 18:04:17 +0200 |
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 <address@hidden>
---
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 <address@hidden>.
+ *
+ * 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
- [Qemu-devel] [RFC PATCH v2 00/13] support hierarchical LUNs, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 02/13] scsi: support parsing of SAM logical unit numbers, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 01/13] scsi: cleanup reset and destroy callbacks, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 03/13] scsi: add initiator field to SCSIRequest, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 04/13] scsi: let a SCSIDevice have children devices, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 05/13] scsi: let the bus pick a LUN for the child device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 06/13] scsi-generic: fix passthrough of devices with LUN != 0, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 07/13] scsi: add walking of hierarchical LUNs, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 08/13] scsi: introduce the scsi-path device,
Paolo Bonzini <=
- [Qemu-devel] [RFC PATCH v2 09/13] scsi: introduce the scsi-target device, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 10/13] scsi: include bus and device levels, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 11/13] qdev: introduce automatic creation of buses, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 12/13] scsi: create scsi-path and scsi-target devices automatically, Paolo Bonzini, 2011/06/06
- [Qemu-devel] [RFC PATCH v2 13/13] scsi: delete handling of REPORT LUNS and unknown LUNs outside scsi-target, Paolo Bonzini, 2011/06/06