hw/scsi: cleanups before VPD BL emulation
commit0a96ca2437646bad197b0108c5f4a93e7ead05a9
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 27 Jun 2018 17:24:30 +0000 (27 14:24 -0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 29 Jun 2018 11:02:50 +0000 (29 13:02 +0200)
tree55870f81c3c2329c66373bea713f2465cd141050
parent2ad9b50f713053dcd6c44b2b5e3bbdb0cfe8a52d
hw/scsi: cleanups before VPD BL emulation

To add support for the emulation of Block Limits VPD page
for passthrough devices, a few adjustments in the current code
base is required to avoid repetition and improve clarity.

In scsi-generic.c, detach the Inquiry handling from
scsi_read_complete and put it into a new function called
scsi_handle_inquiry_reply. This change aims to avoid
cluttering of scsi_read_complete when we more logic in the
Inquiry response handling is added in the next patches,
centralizing the changes in the new function.

In scsi-disk.c, take the build of all emulated VPD pages
from scsi_disk_emulate_inquiry and make it available to
other files into a non-static function called
scsi_disk_emulate_vpd_page. Making it public will allow
the future VPD BL emulation code for passthrough devices
to use it from scsi-generic.c, avoiding copy/pasting this
code solely for that purpose. It also has the advantage of
providing emulation of all VPD pages in case we need to
emulate other pages in other scenarios. As a bonus,
scsi_disk_emulate_inquiry got tidier.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20180627172432.11120-2-danielhb413@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-disk.c
hw/scsi/scsi-generic.c
include/hw/scsi/scsi.h