From patchwork Mon May 9 12:47:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 9046321 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD5FD9F1D3 for ; Mon, 9 May 2016 12:48:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0169C20145 for ; Mon, 9 May 2016 12:48:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2557020123 for ; Mon, 9 May 2016 12:48:19 +0000 (UTC) Received: from localhost ([::1]:41125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azkbi-00059x-9p for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 08:48:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azkbK-0004q3-9V for qemu-devel@nongnu.org; Mon, 09 May 2016 08:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azkbD-0004Zy-1p for qemu-devel@nongnu.org; Mon, 09 May 2016 08:47:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azkbC-0004ZJ-QO for qemu-devel@nongnu.org; Mon, 09 May 2016 08:47:46 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FA6B3B72A; Mon, 9 May 2016 12:47:46 +0000 (UTC) Received: from localhost (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u49CliuF023065; Mon, 9 May 2016 08:47:45 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Mon, 9 May 2016 13:47:34 +0100 Message-Id: <1462798061-30382-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1462798061-30382-1-git-send-email-stefanha@redhat.com> References: <1462798061-30382-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 09 May 2016 12:47:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RESEND PATCH v3 1/8] libqos: use virtio_ids.h for device ID definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marc.mari.barcelo@gmail.com, Paolo Bonzini , jsnow@redhat.com, Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid redefining device IDs. Use the standard Linux headers that are already in the source tree. Signed-off-by: Stefan Hajnoczi --- 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 3a66630..02107a6 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -19,6 +19,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 @@ -119,9 +120,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); @@ -733,7 +734,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 04cfcd5..7fd7a2f 100644 --- a/tests/virtio-net-test.c +++ b/tests/virtio-net-test.c @@ -21,6 +21,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 @@ -40,9 +41,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 d78747a..625bd6d 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -18,6 +18,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 @@ -164,10 +165,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);