Add initial support for SANITIZE and a simple test to generate this opcode.
Add helpers for the SANITIZE service actions
TESTS: Add a simple test for SANITIZE OVERWRITE
Add tests from SANITIZE OVERWRITE parameter length
Add test that all undefined SANITIZE service actions return an error.
Update SANITIZE OVERWRITE tests, test one block/half block and 4 byte
initialization pattern.
Tests: Update the SANITIZE tests
TESTS: Try reading the BlockDeviceCharacteristics VPD page on startup
Block Device Characteristics: Add decode of the rest of this page that was missing
Fix block limit tests

The tests currently verify whether two block limits are above 2**20. Change
these tests into <= 2**20.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Fix a buffer overflow in the code for unmarshalling the, PERSISTENT RESERVE IN / READ RESERVATION

If no reservation is held a SCSI target sends a response that is eight
bytes long while scsi-lowlevel.c fills in the first twelve bytes of a
data structure for which only eight bytes are allocated. Fix this buffer
overflow by always allocating a full
scsi_persistent_reserve_in_read_reservation structure.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Fix PERSISTENT RESERVE IN / READ RESERVATION response unmarshalling

The code that verifies the pr_type response must compare only the
lower four bits of byte 21 of the response ("TYPE") and must ignore
the upper four bits ("SCOPE").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Fix scsi_cdb_read6()

The maximum number of blocks that can be transferred at once via a READ6
command is 256 instead of 265.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
TESTS: Remove the READ6 0-blocks test.
Since you can not request a read for 0 blocks with READ6
this test makes no sense.
(transfer length ==0  means 256 blocks for READ6)
TESTS: For the inquiry test for whether a target only looks at the low
order byte of the two byte transfer length field or not.
Since the maximum size of a std vpd page takes 260 bytes to transfer
and some targets send this much,  testing and comparing the returned buffer
between allocation length == 255 and == 256 doesnt work.
Instead change test to verify that allocation length 511 and 512 returns the same amount and content of data.

This test then still allows finding targets that only look at the low order byte
(which is 0xff for 511   but is 0 for 512)
Type: print correct sizes we test for for std inquiry page
TESTS: Initialize is_usb or else it will be very seldom that is_usb==0 and thus we dont truncate the transferlengths
TEST: READ6 add a test to verify that READ6 with transferlength
gets 256 blocks of data back from the target.
READ6, make the truncation from a potantial 9-bit value (0-256) to 8 bits
explicit by masking it with 0xff instead of relying on obscure truncation
rules.
TESTS: Add a simple test for MODESENSE6  that we can read it and we get at least 3 bydet of mode data (minimum size, header only)