• P
    scsi: add free_request callback · 8e86b93c
    Paolo Bonzini 提交于
    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: NPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
    8e86b93c
scsi.h 8.0 KB