mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
scsi: Add 'hba_private' to SCSIRequest
'tag' is just an abstraction to identify the command from the driver. So we should make that explicit by replacing 'tag' with a driver-defined pointer 'hba_private'. This saves the lookup for driver handling several commands in parallel. 'tag' is still being kept for tracing purposes. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
348e7b8dcd
commit
c5bf71a9a3
8 changed files with 37 additions and 52 deletions
10
hw/scsi.h
10
hw/scsi.h
|
@ -43,6 +43,7 @@ struct SCSIRequest {
|
|||
} cmd;
|
||||
BlockDriverAIOCB *aiocb;
|
||||
bool enqueued;
|
||||
void *hba_private;
|
||||
QTAILQ_ENTRY(SCSIRequest) next;
|
||||
};
|
||||
|
||||
|
@ -67,7 +68,8 @@ struct SCSIDeviceInfo {
|
|||
DeviceInfo qdev;
|
||||
scsi_qdev_initfn init;
|
||||
void (*destroy)(SCSIDevice *s);
|
||||
SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun);
|
||||
SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun,
|
||||
void *hba_private);
|
||||
void (*free_req)(SCSIRequest *req);
|
||||
int32_t (*send_command)(SCSIRequest *req, uint8_t *buf);
|
||||
void (*read_data)(SCSIRequest *req);
|
||||
|
@ -138,8 +140,10 @@ extern const struct SCSISense sense_code_LUN_FAILURE;
|
|||
int scsi_build_sense(SCSISense sense, uint8_t *buf, int len, int fixed);
|
||||
int scsi_sense_valid(SCSISense sense);
|
||||
|
||||
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun);
|
||||
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun);
|
||||
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag,
|
||||
uint32_t lun, void *hba_private);
|
||||
SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,
|
||||
void *hba_private);
|
||||
int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf);
|
||||
void scsi_req_free(SCSIRequest *req);
|
||||
SCSIRequest *scsi_req_ref(SCSIRequest *req);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue