Remove generated versions of docs

It should still be relatively easy for users to generate docs by
running 'make' and having xsltproc installed, or I've also found that
Googling commands also tends to bring up the html versions that people
have published online.

Clean generated files in doc/Makefile.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
rename macro str_to_val to str_to_int

The name str_to_val of a macro in util.h has been used in iscsi/param.h
as the structure field iscsi_key_ops::val_to_str.
To avoid possible conflicts str_to_val macro is renamed to str_to_int.

Signed-off-by: Alexander Nezhinsky <alexandern@mellanox.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.22

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ssc: 32bit arch can't handle large image files

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgtimg: fix ssc image capacity bug

tgtimg can't create large image files.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgtimg: fix compile warning

tgtimg.c: In function ‘ssc_new’:
tgtimg.c:262: warning: format ‘%llu’ expects type ‘long long unsigned in’, but argument 3 has type ‘uint64_t

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
mmc: READ TOC track==0 is valid

READ TOC  track==xyz means : return all tracks starting at number xyz.
In case of single session disks, the only track that exists is track 1
in which case we still need to return the information for track 1
regardless of whether the initiator asks for track 0 or track 1.

i.e.  READ TOC track==0 is still a valid command even if track 0 does not exist

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt 1.0.23

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
MMC: Allow creating MMC LUNS that do not have a backingstore.

An MMC device without a backing store is emulated as an empty drive, with no media in it. TGTD will respond to all scsi i/o just like a scsi dved drive that does not have any media.

As soon as a backing store is added at a later time, the TGTD emulation will switch to instead emulate a DVD drive with either a blank disk in the tray, that can be written to (if the file is zero-length) or as a DVD drive with a DVD-ROM disk in the tray (if the backing store is a .iso image)

Being able to create DVD drives without any backing file is useful for when creating a jukebox. In that case it is most convenient to create the drive without any media loaded and then later use MTX to move media from astorage slot into the drive.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
spc: Fix a few spots to use PCODE_OFFSET

Fix a few missed spots that were not converted to using PCODE_OFFSET for
the lu_vpd array.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
add support for block limits VPD (0xb0) to tgtd

This is needed to support larger phys block sizes in direct-store
backstores.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
support new fields in READ CAPACITY (16)

Enable setting Logical Blocks per Physical Block Exponent and
Lowest Aligned LBA. This is needed to expose underlying device
properties in the iscsi lun.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
tgt-admin: Base blocksize & params on backing store if direct-store

Use sg_inq and sg_readcap to read properties of backing device for
direct-store LUNs. Pass these values to tgtadm so the exported LUN can
match its backstore.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Document new config options for pass-through direct-store properties

tgt-admin should be setting these params based on values it discovers via
sg3_utils. However, they can theoretically be put in targets.conf, so
mention them in the docs, but with a warning they should probably not be
used.

Fix whitespace for block-size option.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ssc: fsync on the final WRITE-FILEMARK

Not for the individual WRITE6 calls.

Add a specific Mode_sense function for SSC devices so we can force the
BUFFERED-MODE in the mode sense data to inidcate that we are doing
buffered writes.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Acked-by: Mark Harvey <markh794@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
add PRE-FETCH10/16 support

Calls posix_fadvise() to tell indicate to the host that we will soon
need to accesas this data.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
sbc: add minimal support for FORMAT-UNIT

FORMAT-UNIT is Mandatory for SBC devices.
At minimum (SBC 5.2.1 FORMAT UNIT COMMAND OVERVIEW)
a SBC device must support the basic FORMAT-UNIT command
with FMTDATA == 0 and DEFECT LIST FORMAT == 000b

No protection information is created with this kind of formatting.

For this specific request that is mandatory, return status ok
but dont actually do anything.

For all optional versions of FORMAT-UNIT just return
ILLEGAL-REQUEST/INVALID_FIELD_IN_CDB

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
spc: add minimal support for SEND-DIAGNOSTICS

This implements the minimum required part of SEND-DIAGNOSTICS
(self-test).

Implement the minimal required part of this opcode. This opcode is
mandatory for sbc and ssc devices but only the SEFT-TEST varient is
required.  Return status good for the default self-test. For all
other varients return ILLEGAL-REQUEST/INVALID_FIELD_IN_CDB

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ssc: honour the readonly attribute

TGTD devices can be set to "readonly" attributes.  Add support to
honour this attribute for SSC devices too.

MODE SENSE (SSC 8.3.1 MODE PARAMETERS OVERVIEW)
  When used with the MODE SENSE command, a write protection (WP) bit
  of zero specifies the medium is write enabled. A WP bit of one
  specifies the medium is currently in the write protected state. When
  used with the MODE SELECT command, this field is ignored.

  NOTE 56 The write protected state may be due to logical unit internal
  restrictions, software write protection, or physical write protection.

In this case "software write protect" applies since the TGTD readonly
attribute for the LUN is set to 1.

SSC 4.2.13 WRITE PROTECTION  TABLE 5 -- ERROR CONDITIONS AND SENSE KEYS
  Attempt to perform an erase, format, partition, set capacity,
  or write-type operation on write protected medium.

  DATA PROTECT

Fail erase/space/write6/writefilemark with DATA_PROTECT/ASC_WRITE_PROTECT
for SSC LUNs that have the readonly attribute set to 1

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ssc: Add offline/medium-not-present support

For Offline SSC devices, return NOT_READY/MEDIUM_NOT_PRESENT for
opcodes that access the media so that we emulate a tape drive with no
tape mounted.

See SSC   4 GENERAL CONCEPTS
  Mounted is the state of a volume when the device is physically
  capable of processing commands that cause the medium to be moved. A
  volume is demounted when it is being loaded, threaded, unloaded,
  unthreaded, or when not attached to the device.

  Ready is the state of the logical unit when medium access and
  non-medium access commands may be processed.

  The logical unit is not ready when no volume is mounted or, from the
  SCSI initiator device perspective, whenever any medium access
  command reports CHECK CONDITION status and a NOT READY sense key.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>