qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 01/20] libqos: use virtio_ids.h for device ID definitions
Date: Mon, 20 Jun 2016 15:05:12 +0100	[thread overview]
Message-ID: <1466431531-17806-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1466431531-17806-1-git-send-email-stefanha@redhat.com>

Avoid redefining device IDs.  Use the standard Linux headers that are
already in the source tree.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1462798061-30382-2-git-send-email-stefanha@redhat.com
---
 tests/libqos/virtio.h    | 9 ---------
 tests/virtio-blk-test.c  | 7 ++++---
 tests/virtio-net-test.c  | 5 +++--
 tests/virtio-scsi-test.c | 5 +++--
 4 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
index 0101278..af03793 100644
--- a/tests/libqos/virtio.h
+++ b/tests/libqos/virtio.h
@@ -19,15 +19,6 @@
 #define QVIRTIO_DRIVER          0x2
 #define QVIRTIO_DRIVER_OK       0x4
 
-#define QVIRTIO_NET_DEVICE_ID       0x1
-#define QVIRTIO_BLK_DEVICE_ID       0x2
-#define QVIRTIO_CONSOLE_DEVICE_ID   0x3
-#define QVIRTIO_RNG_DEVICE_ID       0x4
-#define QVIRTIO_BALLOON_DEVICE_ID   0x5
-#define QVIRTIO_RPMSG_DEVICE_ID     0x7
-#define QVIRTIO_SCSI_DEVICE_ID      0x8
-#define QVIRTIO_9P_DEVICE_ID        0x9
-
 #define QVIRTIO_F_NOTIFY_ON_EMPTY       0x01000000
 #define QVIRTIO_F_ANY_LAYOUT            0x08000000
 #define QVIRTIO_F_RING_INDIRECT_DESC    0x10000000
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
index 8272ba8..a0d2d83 100644
--- a/tests/virtio-blk-test.c
+++ b/tests/virtio-blk-test.c
@@ -18,6 +18,7 @@
 #include "libqos/malloc-pc.h"
 #include "libqos/malloc-generic.h"
 #include "qemu/bswap.h"
+#include "standard-headers/linux/virtio_ids.h"
 
 #define QVIRTIO_BLK_F_BARRIER       0x00000001
 #define QVIRTIO_BLK_F_SIZE_MAX      0x00000002
@@ -118,9 +119,9 @@ static QVirtioPCIDevice *virtio_blk_pci_init(QPCIBus *bus, int slot)
 {
     QVirtioPCIDevice *dev;
 
-    dev = qvirtio_pci_device_find(bus, QVIRTIO_BLK_DEVICE_ID);
+    dev = qvirtio_pci_device_find(bus, VIRTIO_ID_BLOCK);
     g_assert(dev != NULL);
-    g_assert_cmphex(dev->vdev.device_type, ==, QVIRTIO_BLK_DEVICE_ID);
+    g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);
     g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN));
 
     qvirtio_pci_device_enable(dev);
@@ -732,7 +733,7 @@ static void mmio_basic(void)
 
     dev = qvirtio_mmio_init_device(MMIO_DEV_BASE_ADDR, MMIO_PAGE_SIZE);
     g_assert(dev != NULL);
-    g_assert_cmphex(dev->vdev.device_type, ==, QVIRTIO_BLK_DEVICE_ID);
+    g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);
 
     qvirtio_reset(&qvirtio_mmio, &dev->vdev);
     qvirtio_set_acknowledge(&qvirtio_mmio, &dev->vdev);
diff --git a/tests/virtio-net-test.c b/tests/virtio-net-test.c
index e5c1448..e49c13e 100644
--- a/tests/virtio-net-test.c
+++ b/tests/virtio-net-test.c
@@ -20,6 +20,7 @@
 #include "libqos/malloc-generic.h"
 #include "qemu/bswap.h"
 #include "hw/virtio/virtio-net.h"
+#include "standard-headers/linux/virtio_ids.h"
 
 #define PCI_SLOT_HP             0x06
 #define PCI_SLOT                0x04
@@ -39,9 +40,9 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)
 {
     QVirtioPCIDevice *dev;
 
-    dev = qvirtio_pci_device_find(bus, QVIRTIO_NET_DEVICE_ID);
+    dev = qvirtio_pci_device_find(bus, VIRTIO_ID_NET);
     g_assert(dev != NULL);
-    g_assert_cmphex(dev->vdev.device_type, ==, QVIRTIO_NET_DEVICE_ID);
+    g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_NET);
 
     qvirtio_pci_device_enable(dev);
     qvirtio_reset(&qvirtio_pci, &dev->vdev);
diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c
index 5f1a8ae..26bb0e3 100644
--- a/tests/virtio-scsi-test.c
+++ b/tests/virtio-scsi-test.c
@@ -17,6 +17,7 @@
 #include "libqos/malloc.h"
 #include "libqos/malloc-pc.h"
 #include "libqos/malloc-generic.h"
+#include "standard-headers/linux/virtio_ids.h"
 
 #define PCI_SLOT                0x02
 #define PCI_FN                  0x00
@@ -163,10 +164,10 @@ static QVirtIOSCSI *qvirtio_scsi_pci_init(int slot)
     vs->alloc = pc_alloc_init();
     vs->bus = qpci_init_pc();
 
-    dev = qvirtio_pci_device_find(vs->bus, QVIRTIO_SCSI_DEVICE_ID);
+    dev = qvirtio_pci_device_find(vs->bus, VIRTIO_ID_SCSI);
     vs->dev = (QVirtioDevice *)dev;
     g_assert(dev != NULL);
-    g_assert_cmphex(vs->dev->device_type, ==, QVIRTIO_SCSI_DEVICE_ID);
+    g_assert_cmphex(vs->dev->device_type, ==, VIRTIO_ID_SCSI);
 
     qvirtio_pci_device_enable(dev);
     qvirtio_reset(&qvirtio_pci, vs->dev);
-- 
2.5.5

  reply	other threads:[~2016-06-20 14:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 14:05 [Qemu-devel] [PULL 00/20] Block patches Stefan Hajnoczi
2016-06-20 14:05 ` Stefan Hajnoczi [this message]
2016-06-20 14:05 ` [Qemu-devel] [PULL 02/20] libqos: drop duplicated PCI vendor ID definition Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 03/20] libqos: drop duplicated virtio_config.h definitions Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 04/20] libqos: drop duplicated virtio_ring.h bit definitions Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 05/20] libqos: drop duplicated virtio_vring.h structs Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 06/20] libqos: drop duplicated virtio_blk.h definitions Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 07/20] libqos: drop duplicated virtio_scsi.h definitions Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 08/20] libqos: drop duplicated virtio_pci.h definitions Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 09/20] libqos: add qvirtqueue_cleanup() Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 10/20] block: fixed BdrvTrackedRequest filling in bdrv_co_discard Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 11/20] block: fix race in bdrv_co_discard with drive-mirror Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 12/20] block: process before_write_notifiers in bdrv_co_discard Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 13/20] blockjob: move iostatus reset out of block_job_enter() Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 14/20] blockjob: rename block_job_is_paused() Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 15/20] blockjob: add pause points Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 16/20] blockjob: add block_job_get_aio_context() Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 17/20] block: use safe iteration over AioContext notifiers Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 18/20] blockjob: add AioContext attached callback Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 19/20] mirror: follow AioContext change gracefully Stefan Hajnoczi
2016-06-20 14:05 ` [Qemu-devel] [PULL 20/20] backup: " Stefan Hajnoczi
2016-06-20 17:08 ` [Qemu-devel] [PULL 00/20] Block patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466431531-17806-2-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).