diff options
author | Daniel Henrique Barboza <danielhb413@gmail.com> | 2018-06-27 14:24:31 -0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-06-29 13:02:50 +0200 |
commit | a0c7e35b17b3d2cade8a5fc8e57904e02fb91fe4 (patch) | |
tree | f0dc2b6caa0729789ee72029191a34bd74069d15 /block/quorum.c | |
parent | 0a96ca2437646bad197b0108c5f4a93e7ead05a9 (diff) | |
download | qemu-a0c7e35b17b3d2cade8a5fc8e57904e02fb91fe4.zip |
hw/scsi: centralize SG_IO calls into single function
For the VPD Block Limits emulation with SCSI passthrough,
we'll issue an Inquiry request with EVPD set to retrieve
the available VPD pages of the device. This would be done in
a way similar of what scsi_generic_read_device_identification
does: create a SCSI command and a reply buffer, fill in the
sg_io_hdr_t structure, call blk_ioctl, check if an error
occurred, process the response.
This same process is done in other 2 functions, get_device_type
and get_stream_blocksize. They differ in the command/reply
buffer and post-processing, everything else is almost a
copy/paste.
Instead of adding a forth copy/pasted-ish code when adding
the passthrough VPD BL emulation, this patch extirpates
this repetition of those 3 functions and put it into
a new one called scsi_SG_IO_FROM_DEV. Any future code that
wants to execute an SG_DXFER_FROM_DEV to the device can
use it, avoiding filling sg_io_hdr_t again and et cetera.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20180627172432.11120-3-danielhb413@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block/quorum.c')
0 files changed, 0 insertions, 0 deletions