mirror of https://github.com/xemu-project/xemu.git
scsi: device version property
This patch adds a new property named 'ver' to scsi-disk which allows to specify the version which the virtual disk/cdrom should report to the guest. By default this is the qemu version (i.e. 0.12). usage: -drive if=none,id=disk,file=... -device lsi -device scsi-disk,drive=disk,bus=scsi.0,unit=0,ver=42 You can also switch the version for all scsi drives using: -global scsi-disk.ver=42 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
47c0634030
commit
383b4d9b79
|
@ -65,6 +65,7 @@ struct SCSIDiskState
|
||||||
int cluster_size;
|
int cluster_size;
|
||||||
uint64_t max_lba;
|
uint64_t max_lba;
|
||||||
QEMUBH *bh;
|
QEMUBH *bh;
|
||||||
|
char *version;
|
||||||
};
|
};
|
||||||
|
|
||||||
static SCSIDiskReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun)
|
static SCSIDiskReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun)
|
||||||
|
@ -315,6 +316,7 @@ static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)
|
||||||
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
||||||
{
|
{
|
||||||
BlockDriverState *bdrv = req->dev->dinfo->bdrv;
|
BlockDriverState *bdrv = req->dev->dinfo->bdrv;
|
||||||
|
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
|
||||||
int buflen = 0;
|
int buflen = 0;
|
||||||
|
|
||||||
if (req->cmd.buf[1] & 0x2) {
|
if (req->cmd.buf[1] & 0x2) {
|
||||||
|
@ -432,7 +434,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
|
||||||
memcpy(&outbuf[16], "QEMU HARDDISK ", 16);
|
memcpy(&outbuf[16], "QEMU HARDDISK ", 16);
|
||||||
}
|
}
|
||||||
memcpy(&outbuf[8], "QEMU ", 8);
|
memcpy(&outbuf[8], "QEMU ", 8);
|
||||||
memcpy(&outbuf[32], QEMU_VERSION, 4);
|
memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4);
|
||||||
/* Identify device as SCSI-3 rev 1.
|
/* Identify device as SCSI-3 rev 1.
|
||||||
Some later commands are also implemented. */
|
Some later commands are also implemented. */
|
||||||
outbuf[2] = 3;
|
outbuf[2] = 3;
|
||||||
|
@ -1029,6 +1031,7 @@ static SCSIDeviceInfo scsi_disk_info = {
|
||||||
.get_buf = scsi_get_buf,
|
.get_buf = scsi_get_buf,
|
||||||
.qdev.props = (Property[]) {
|
.qdev.props = (Property[]) {
|
||||||
DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.dinfo),
|
DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.dinfo),
|
||||||
|
DEFINE_PROP_STRING("ver", SCSIDiskState, version),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue