[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cdi-devel] [PATCH v2 4/9] cdi/scsi: Add support for multiple LUNs

On 16.04.2015 23:14, Kevin Wolf wrote:
On Thu, Apr 16, 2015 at 10:51:23PM +0200, Max Reitz wrote:
On 16.04.2015 22:46, Kevin Wolf wrote:
On Thu, Apr 16, 2015 at 12:13:53AM +0200, Max Reitz wrote:
+ One SCSI device may provide multiple LUNs. Add a field for the LUN
   count to cdi_scsi_device.
+ Furthermore, add a field to select the LUN to cdi_scsi_packet.

Signed-off-by: Max Reitz <max@xxxxxxxxxx>
  include/cdi/scsi.h | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/include/cdi/scsi.h b/include/cdi/scsi.h
index cef96ed..f36f9aa 100644
--- a/include/cdi/scsi.h
+++ b/include/cdi/scsi.h
@@ -24,6 +24,9 @@
  /// SCSI-Paket
  struct cdi_scsi_packet {
+    /// LUN to address
+    int lun;
      /// Buffer zum Senden oder Empfangen von Daten
      void *buffer;
@@ -51,6 +54,9 @@ struct cdi_scsi_device {
      /// Geraetetyp, der ueber SCSI angesteuert wird
      cdi_device_type_t type;
+    /// Number of LUNs (if 0, there is one)
+    int lun_count;
Why special-case 0 instead of putting 1 there for a single LUN? Or do
you mean number of LUNs - 1 even for more than one LUN?
For legacy reasons. A legacy SCSI driver will not set this field,
thus it will remain 0 (which we have to interpret somehow).
You don't want to go there. SCSI drivers can just be updated, that's
much better than bothering with legacy code.

I didn't reply to the cover letter yet, where you say that you're not
confident about the HID interface, but it's really the same thing: The
compatibility policy of CDI is that there is no compatibility between
versions, neither in binary nor in source.

This allows us to take any hack that works, and if it turns out that we
messed up, we simply change the interface and adjust the drivers and the
OS implementations.

We can start caring about compatibility once we're convinced that CDI is
mature and widespread so that updating OSes would be more pain than
maintaining compatibility code, but I don't think we're even close to

Well, it's your call.