diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c index bdd6e947f219952a2a825687ba98f63f23bfc5ab..1f38ac88e503f3d8e84936ba7bf109b36d2147da 100644 --- a/hw/scsi-bus.c +++ b/hw/scsi-bus.c @@ -160,7 +160,7 @@ static int32_t scsi_invalid_command(SCSIRequest *req, uint8_t *buf) return 0; } -struct SCSIReqOps reqops_invalid_opcode = { +static const struct SCSIReqOps reqops_invalid_opcode = { .size = sizeof(SCSIRequest), .send_command = scsi_invalid_command }; @@ -178,7 +178,7 @@ static int32_t scsi_unit_attention(SCSIRequest *req, uint8_t *buf) return 0; } -struct SCSIReqOps reqops_unit_attention = { +static const struct SCSIReqOps reqops_unit_attention = { .size = sizeof(SCSIRequest), .send_command = scsi_unit_attention }; @@ -386,7 +386,7 @@ static uint8_t *scsi_target_get_buf(SCSIRequest *req) return r->buf; } -struct SCSIReqOps reqops_target_command = { +static const struct SCSIReqOps reqops_target_command = { .size = sizeof(SCSITargetReq), .send_command = scsi_target_send_command, .read_data = scsi_target_read_data, @@ -394,8 +394,8 @@ struct SCSIReqOps reqops_target_command = { }; -SCSIRequest *scsi_req_alloc(SCSIReqOps *reqops, SCSIDevice *d, uint32_t tag, - uint32_t lun, void *hba_private) +SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, + uint32_t tag, uint32_t lun, void *hba_private) { SCSIRequest *req; diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 74990a82990b10c15b2c3adb167d949a0eeb603d..77673f251a71e045f59f440f4f40e058ddbbcafc 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -1588,7 +1588,7 @@ static int scsi_disk_initfn(SCSIDevice *dev) } } -static SCSIReqOps scsi_disk_reqops = { +static const SCSIReqOps scsi_disk_reqops = { .size = sizeof(SCSIDiskReq), .free_req = scsi_free_request, .send_command = scsi_send_command, diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c index fcf23cd8cd05dfc34b8704c64452b07511810332..a5e77cb1097b20b12309cd6d059899222666336b 100644 --- a/hw/scsi-generic.c +++ b/hw/scsi-generic.c @@ -420,7 +420,7 @@ static int scsi_generic_initfn(SCSIDevice *s) return 0; } -static SCSIReqOps scsi_generic_req_ops = { +static const SCSIReqOps scsi_generic_req_ops = { .size = sizeof(SCSIGenericReq), .free_req = scsi_free_request, .send_command = scsi_send_command, diff --git a/hw/scsi.h b/hw/scsi.h index d56e875672db69bdfa23ca1aedf08bfe3cb80281..af558c3a1677006d74f6d04f3adda678516e1240 100644 --- a/hw/scsi.h +++ b/hw/scsi.h @@ -41,7 +41,7 @@ struct SCSICommand { struct SCSIRequest { SCSIBus *bus; SCSIDevice *dev; - SCSIReqOps *ops; + const SCSIReqOps *ops; uint32_t refcount; uint32_t tag; uint32_t lun; @@ -96,7 +96,6 @@ struct SCSIDeviceInfo { SCSIRequest *(*alloc_req)(SCSIDevice *s, uint32_t tag, uint32_t lun, void *hba_private); void (*unit_attention_reported)(SCSIDevice *s); - SCSIReqOps reqops; }; struct SCSIBusInfo { @@ -176,8 +175,8 @@ extern const struct SCSISense sense_code_DEVICE_INTERNAL_RESET; int scsi_sense_valid(SCSISense sense); -SCSIRequest *scsi_req_alloc(SCSIReqOps *reqops, SCSIDevice *d, uint32_t tag, - uint32_t lun, void *hba_private); +SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, + uint32_t tag, uint32_t lun, void *hba_private); SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun, uint8_t *buf, void *hba_private); int32_t scsi_req_enqueue(SCSIRequest *req);