Skip to content

Commit

Permalink
libqos: drop duplicated virtio_blk.h definitions
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1462798061-30382-7-git-send-email-stefanha@redhat.com
  • Loading branch information
stefanhaRH committed Jun 20, 2016
1 parent 780b11a commit 4565a3e
Showing 1 changed file with 16 additions and 34 deletions.
50 changes: 16 additions & 34 deletions tests/virtio-blk-test.c
Expand Up @@ -21,25 +21,7 @@
#include "standard-headers/linux/virtio_ids.h"
#include "standard-headers/linux/virtio_config.h"
#include "standard-headers/linux/virtio_ring.h"

#define QVIRTIO_BLK_F_BARRIER 0x00000001
#define QVIRTIO_BLK_F_SIZE_MAX 0x00000002
#define QVIRTIO_BLK_F_SEG_MAX 0x00000004
#define QVIRTIO_BLK_F_GEOMETRY 0x00000010
#define QVIRTIO_BLK_F_RO 0x00000020
#define QVIRTIO_BLK_F_BLK_SIZE 0x00000040
#define QVIRTIO_BLK_F_SCSI 0x00000080
#define QVIRTIO_BLK_F_WCE 0x00000200
#define QVIRTIO_BLK_F_TOPOLOGY 0x00000400
#define QVIRTIO_BLK_F_CONFIG_WCE 0x00000800

#define QVIRTIO_BLK_T_IN 0
#define QVIRTIO_BLK_T_OUT 1
#define QVIRTIO_BLK_T_SCSI_CMD 2
#define QVIRTIO_BLK_T_SCSI_CMD_OUT 3
#define QVIRTIO_BLK_T_FLUSH 4
#define QVIRTIO_BLK_T_FLUSH_OUT 5
#define QVIRTIO_BLK_T_GET_ID 8
#include "standard-headers/linux/virtio_blk.h"

#define TEST_IMAGE_SIZE (64 * 1024 * 1024)
#define QVIRTIO_BLK_TIMEOUT_US (30 * 1000 * 1000)
Expand Down Expand Up @@ -186,14 +168,14 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev,
features = features & ~(QVIRTIO_F_BAD_FEATURE |
(1u << VIRTIO_RING_F_INDIRECT_DESC) |
(1u << VIRTIO_RING_F_EVENT_IDX) |
QVIRTIO_BLK_F_SCSI);
(1u << VIRTIO_BLK_F_SCSI));
qvirtio_set_features(bus, dev, features);

qvirtio_set_driver_ok(bus, dev);

/* Write and read with 3 descriptor layout */
/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand All @@ -216,7 +198,7 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev,
guest_free(alloc, req_addr);

/* Read request */
req.type = QVIRTIO_BLK_T_IN;
req.type = VIRTIO_BLK_T_IN;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand Down Expand Up @@ -245,7 +227,7 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev,
if (features & (1u << VIRTIO_F_ANY_LAYOUT)) {
/* Write and read with 2 descriptor layout */
/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 1;
req.data = g_malloc0(512);
Expand All @@ -266,7 +248,7 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev,
guest_free(alloc, req_addr);

/* Read request */
req.type = QVIRTIO_BLK_T_IN;
req.type = VIRTIO_BLK_T_IN;
req.ioprio = 1;
req.sector = 1;
req.data = g_malloc0(512);
Expand Down Expand Up @@ -354,7 +336,7 @@ static void pci_indirect(void)
g_assert_cmphex(features & (1u << VIRTIO_RING_F_INDIRECT_DESC), !=, 0);
features = features & ~(QVIRTIO_F_BAD_FEATURE |
(1u << VIRTIO_RING_F_EVENT_IDX) |
QVIRTIO_BLK_F_SCSI);
(1u << VIRTIO_BLK_F_SCSI));
qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);

alloc = pc_alloc_init();
Expand All @@ -363,7 +345,7 @@ static void pci_indirect(void)
qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);

/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand All @@ -388,7 +370,7 @@ static void pci_indirect(void)
guest_free(alloc, req_addr);

/* Read request */
req.type = QVIRTIO_BLK_T_IN;
req.type = VIRTIO_BLK_T_IN;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand Down Expand Up @@ -496,7 +478,7 @@ static void pci_msix(void)
features = features & ~(QVIRTIO_F_BAD_FEATURE |
(1u << VIRTIO_RING_F_INDIRECT_DESC) |
(1u << VIRTIO_RING_F_EVENT_IDX) |
QVIRTIO_BLK_F_SCSI);
(1u << VIRTIO_BLK_F_SCSI));
qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);

vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev,
Expand All @@ -515,7 +497,7 @@ static void pci_msix(void)
g_assert_cmpint(capacity, ==, n_size / 512);

/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand All @@ -539,7 +521,7 @@ static void pci_msix(void)
guest_free(alloc, req_addr);

/* Read request */
req.type = QVIRTIO_BLK_T_IN;
req.type = VIRTIO_BLK_T_IN;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand Down Expand Up @@ -612,7 +594,7 @@ static void pci_idx(void)
features = features & ~(QVIRTIO_F_BAD_FEATURE |
(1u << VIRTIO_RING_F_INDIRECT_DESC) |
(1u << VIRTIO_F_NOTIFY_ON_EMPTY) |
QVIRTIO_BLK_F_SCSI);
(1u << VIRTIO_BLK_F_SCSI));
qvirtio_set_features(&qvirtio_pci, &dev->vdev, features);

vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev,
Expand All @@ -622,7 +604,7 @@ static void pci_idx(void)
qvirtio_set_driver_ok(&qvirtio_pci, &dev->vdev);

/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 0;
req.data = g_malloc0(512);
Expand All @@ -641,7 +623,7 @@ static void pci_idx(void)
QVIRTIO_BLK_TIMEOUT_US);

/* Write request */
req.type = QVIRTIO_BLK_T_OUT;
req.type = VIRTIO_BLK_T_OUT;
req.ioprio = 1;
req.sector = 1;
req.data = g_malloc0(512);
Expand All @@ -667,7 +649,7 @@ static void pci_idx(void)
guest_free(alloc, req_addr);

/* Read request */
req.type = QVIRTIO_BLK_T_IN;
req.type = VIRTIO_BLK_T_IN;
req.ioprio = 1;
req.sector = 1;
req.data = g_malloc0(512);
Expand Down

0 comments on commit 4565a3e

Please sign in to comment.