scsi: add free_request callback
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 9 Jul 2012 10:06:28 +0000 (12:06 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 10 Jul 2012 11:35:05 +0000 (13:35 +0200)
commit8e86b93c2b69a7369aa62a6daec203fe5e757497
tree15625220161591ccea5b760795cd1a2f6450fed5
parent92336855975805d88c7979f53bc05c2d47abab04
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>
hw/scsi-bus.c
hw/scsi.h