util: add return value to qemu_iovec_concat_iov

This will be necessary later to recognize the case where a
request has both dataout and datain.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: start preparing for any_layout

- Introduce virtio_scsi_init_req and virtio_scsi_free_req

- rename qemu_sgl_init_external to qemu_sgl_concat

- move virtio_scsi_parse_req from virtio_scsi_pop_req to callers
  and add header length checks to virtio_scsi_parse_req.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: add target swap for VirtIOSCSICtrlTMFReq fields

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: add extra argument and return type to qemu_sgl_concat

Will be used for anylayout support.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: prepare sense data handling for any_layout

Retrieve sense and copy it to guest memory, to prepare for when we will use
qemu_iovec_from_buf.

Swap response and request, since we'll use the tail of VirtIOSCSIReq
for the CDB.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: introduce virtio_scsi_complete_cmd_req

This is also related to sense handling, and will be used
by anylayout.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virtio-scsi: add support for the any_layout feature

Store the request and response headers by value, and let
virtio_scsi_parse_req check that there is only one of datain
and dataout.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>