/* Test WRITE SAME with the lba not aligned */ static void test_unaligned_write_same(void *obj, void *data, QGuestAllocator *t_alloc) { QVirtioSCSI *scsi = obj; QVirtioSCSIQueues *vs; uint8_t buf1[512] = { 0 }; uint8_t buf2[512] = { 1 }; const uint8_t write_same_cdb_1[VIRTIO_SCSI_CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00 }; const uint8_t write_same_cdb_2[VIRTIO_SCSI_CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x33, 0x00, 0x00 }; const uint8_t write_same_cdb_ndob[VIRTIO_SCSI_CDB_SIZE] = { 0x41, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x33, 0x00, 0x00 }; alloc = t_alloc; vs = qvirtio_scsi_init(scsi->vdev); g_assert_cmphex(0, ==, virtio_scsi_do_command(vs, write_same_cdb_1, NULL, 0, buf1, 512, NULL)); g_assert_cmphex(0, ==, virtio_scsi_do_command(vs, write_same_cdb_2, NULL, 0, buf2, 512, NULL)); g_assert_cmphex(0, ==, virtio_scsi_do_command(vs, write_same_cdb_ndob, NULL, 0, NULL, 0, NULL)); qvirtio_scsi_pci_free(vs); }
/* Test WRITE SAME with the lba not aligned */ static void test_unaligned_write_same(void) { QVirtIOSCSI *vs; uint8_t buf1[512] = { 0 }; uint8_t buf2[512] = { 1 }; const uint8_t write_same_cdb_1[VIRTIO_SCSI_CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00 }; const uint8_t write_same_cdb_2[VIRTIO_SCSI_CDB_SIZE] = { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x33, 0x00, 0x00 }; vs = qvirtio_scsi_pci_init(PCI_SLOT); g_assert_cmphex(0, ==, virtio_scsi_do_command(vs, write_same_cdb_1, NULL, 0, buf1, 512, NULL)); g_assert_cmphex(0, ==, virtio_scsi_do_command(vs, write_same_cdb_2, NULL, 0, buf2, 512, NULL)); qvirtio_scsi_pci_free(vs); }