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 <rkagan@virtuozzo.com>
2 files changed
tree: e6ea6779c44c301425aec64654646e5efd87b143
  1. .gitignore
  2. COPYING
  3. COPYING.LESSER
  4. Makefile
  5. README
  6. docs/
  7. scripts/
  8. src/
  9. vgasrc/