blockcmd: generic SCSI luns enumeration
Add two generic functions to discover active LUNs on a SCSI target.
The functions take a temporary drive descriptor on the target, and a
callback to create a new drive descriptor with a new LUN using the
temporary one as a template.
One of the functions performs REPORT LUNS on the temporary drive to
obtain the list of candidate luns; the other sequentially iterates the
lun numbers up to the given maximum, and is meant as a fallback. Both
functions return the number of successfully created drive descriptors,
or a negative number if an error occured.
This will allow to lift the limitation of most of the SCSI drivers that
support booting off the LUN #0 only.
Signed-off-by: Roman Kagan <email@example.com>
2 files changed