[cdi-devel] [PATCH v2 4/9] cdi/scsi: Add support for multiple LUNs
Max Reitz ·
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 at tyndur.org> >> --- >> 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). Max