qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL 40/96] virtio-scsi: use standard-headers


From: Fam Zheng
Subject: Re: [Qemu-devel] [PULL 40/96] virtio-scsi: use standard-headers
Date: Wed, 11 Mar 2015 15:14:16 +0800
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, 02/18 22:48, Michael S. Tsirkin wrote:
> Drop duplicated code.
> 
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> Acked-by: Paolo Bonzini <address@hidden>

Michael, this breaks virtio-scsi-pci:

    qemu-system-x86_64: wrong size for virtio-scsi headers

Because:

> -
> -/* SCSI command request, followed by CDB and data-out */
> -typedef struct {
> -    uint8_t lun[8];              /* Logical Unit Number */
> -    uint64_t tag;                /* Command identifier */
> -    uint8_t task_attr;           /* Task attribute */
> -    uint8_t prio;
> -    uint8_t crn;

This doesn't have the cdb array (it is dynamically alloated and appended to the
end of VirtIOSCSIReq, the allocation size depends on guest configured
cdb_size)...

> -} QEMU_PACKED VirtIOSCSICmdReq;
> -

<snip>

> -typedef struct {
> -    uint32_t num_queues;
> -    uint32_t seg_max;
> -    uint32_t max_sectors;
> -    uint32_t cmd_per_lun;
> -    uint32_t event_info_size;
> -    uint32_t sense_size;
> -    uint32_t cdb_size;
> -    uint16_t max_channel;
> -    uint16_t max_target;
> -    uint32_t max_lun;
> -} QEMU_PACKED VirtIOSCSIConfig;
> +typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq;

But in virtio_scsi_cmd_req:

    /* SCSI command request, followed by data-out */
    struct virtio_scsi_cmd_req {
            uint8_t lun[8];         /* Logical Unit Number */
            __virtio64 tag;         /* Command identifier */
            uint8_t task_attr;              /* Task attribute */
            uint8_t prio;           /* SAM command priority field */
            uint8_t crn;
            uint8_t cdb[VIRTIO_SCSI_CDB_SIZE];
    } QEMU_PACKED;

the cdb array is fixed and inlined.

Fam



reply via email to

[Prev in Thread] Current Thread [Next in Thread]