diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-07-09 12:06:28 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-07-10 13:35:05 +0200 |
commit | 8e86b93c2b69a7369aa62a6daec203fe5e757497 (patch) | |
tree | 15625220161591ccea5b760795cd1a2f6450fed5 /hw/scsi.h | |
parent | 92336855975805d88c7979f53bc05c2d47abab04 (diff) | |
download | qemu-8e86b93c2b69a7369aa62a6daec203fe5e757497.tar.gz qemu-8e86b93c2b69a7369aa62a6daec203fe5e757497.tar.bz2 qemu-8e86b93c2b69a7369aa62a6daec203fe5e757497.zip |
scsi: add free_request callback
Most device models have a simple lifecycle for the hba_private field
and they can free it when a request is completed or cancelled.
However, in some cases it may be simpler to tie the lifetime
of hba_private to that of the included SCSIRequest. This patch
adds a free_request callback to SCSIBusInfo that lets an HBA
device model do exactly that.
Normally, device models use req->hba_private == NULL to flag requests
that have been completed already. Device models that use free_request
will still need to track this using a flag. This is the reason why
"converting" existing HBAs to use free_request adds complexity and
makes little sense. It is simply an additional convenience that is
provided by the SCSI layer. USB-attached storage will be the first
user.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/scsi.h')
-rw-r--r-- | hw/scsi.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -134,6 +134,7 @@ struct SCSIBusInfo { void (*save_request)(QEMUFile *f, SCSIRequest *req); void *(*load_request)(QEMUFile *f, SCSIRequest *req); + void (*free_request)(SCSIBus *bus, void *priv); }; #define TYPE_SCSI_BUS "SCSI" |