tests/libqos: rename qpci_init_pc and qpci_init_spapr functions
authorEmanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Thu, 19 Jul 2018 11:50:27 +0000 (13:50 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 7 Mar 2019 15:50:04 +0000 (16:50 +0100)
Rename qpci_init_pc in qpci_pc_new and qpci_init_spapr in qpci_spapr_new,
since these function actually allocate a new pci struct and initialize it
(compare to object_new and object_initialize).
Changed QOSOps field name from qpci_init to qpci_new.

Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
18 files changed:
tests/e1000e-test.c
tests/i440fx-test.c
tests/ide-test.c
tests/libqos/ahci.c
tests/libqos/libqos-pc.c
tests/libqos/libqos-spapr.c
tests/libqos/libqos.c
tests/libqos/libqos.h
tests/libqos/pci-pc.c
tests/libqos/pci-pc.h
tests/libqos/pci-spapr.c
tests/libqos/pci-spapr.h
tests/q35-test.c
tests/rtl8139-test.c
tests/sdhci-test.c
tests/tco-test.c
tests/usb-hcd-ehci-test.c
tests/vhost-user-test.c

index c9408a5d1fc19761ffab9e58a92dcba03f8bd954..5525589e5b5841f2d251e624c01542817e73d53c 100644 (file)
@@ -395,7 +395,7 @@ static void data_test_init(e1000e_device *d)
     test_alloc = pc_alloc_init(global_qtest);
     g_assert_nonnull(test_alloc);
 
-    test_bus = qpci_init_pc(global_qtest, test_alloc);
+    test_bus = qpci_new_pc(global_qtest, test_alloc);
     g_assert_nonnull(test_bus);
 
     e1000e_device_init(test_bus, d);
index 4390e5591e56cd1c4cc656e33e092f35f397e8a5..69205b58a8cf7971ed808580247800bb754f29d2 100644 (file)
@@ -38,7 +38,7 @@ static QPCIBus *test_start_get_bus(const TestData *s)
     cmdline = g_strdup_printf("-smp %d", s->num_cpus);
     qtest_start(cmdline);
     g_free(cmdline);
-    return qpci_init_pc(global_qtest, NULL);
+    return qpci_new_pc(global_qtest, NULL);
 }
 
 static void test_i440fx_defaults(gconstpointer opaque)
index 300d64e77ddf6be63ebc0cd14e89fd38846405f0..46898d96bf48598c0bc69a6275ec0c889e1d99d3 100644 (file)
@@ -157,7 +157,7 @@ static QPCIDevice *get_pci_device(QPCIBar *bmdma_bar, QPCIBar *ide_bar)
     uint16_t vendor_id, device_id;
 
     if (!pcibus) {
-        pcibus = qpci_init_pc(global_qtest, NULL);
+        pcibus = qpci_new_pc(global_qtest, NULL);
     }
 
     /* Find PCI device and verify it's the right one */
index 63fbc9e3c98e76a6fd31d8f28de1be26923ac369..cc1b08eabef0e4900448f9e32ffd3b83fdee9e0f 100644 (file)
@@ -130,7 +130,7 @@ QPCIDevice *get_ahci_device(QTestState *qts, uint32_t *fingerprint)
     uint32_t ahci_fingerprint;
     QPCIBus *pcibus;
 
-    pcibus = qpci_init_pc(qts, NULL);
+    pcibus = qpci_new_pc(qts, NULL);
 
     /* Find the AHCI PCI device and verify it's the right one. */
     ahci = qpci_device_find(pcibus, QPCI_DEVFN(0x1F, 0x02));
index a9c1aceaa7b30eeb7c67eb3b5b3923fe363bcdd7..293f9b6fe6485b294b430a9f913c8cc14be0c5f1 100644 (file)
@@ -6,7 +6,7 @@
 static QOSOps qos_ops = {
     .init_allocator = pc_alloc_init_flags,
     .uninit_allocator = pc_alloc_uninit,
-    .qpci_init = qpci_init_pc,
+    .qpci_new = qpci_new_pc,
     .qpci_free = qpci_free_pc,
     .shutdown = qtest_pc_shutdown,
 };
index a37791e5d0df9f830b92d781d91b6b0ab640c201..64addfe577bbe6321b70b555c8c64d4025b07dd3 100644 (file)
@@ -6,7 +6,7 @@
 static QOSOps qos_ops = {
     .init_allocator = spapr_alloc_init_flags,
     .uninit_allocator = spapr_alloc_uninit,
-    .qpci_init = qpci_init_spapr,
+    .qpci_new = qpci_new_spapr,
     .qpci_free = qpci_free_spapr,
     .shutdown = qtest_spapr_shutdown,
 };
index c514187344824554d70b5241f2f77d2eafdaa893..6c9137165d6caa6487e39abfc0b75ef7273c45a1 100644 (file)
@@ -25,7 +25,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
     qs->ops = ops;
     if (ops) {
         qs->alloc = ops->init_allocator(qs->qts, ALLOC_NO_FLAGS);
-        qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);
+        qs->pcibus = ops->qpci_new(qs->qts, qs->alloc);
     }
 
     g_free(cmdline);
index 07d4b93d1d73ac12df7bb13595c6ebadf1cfdd43..1af6035db40212855e89e36decb3e8d05bd8576a 100644 (file)
@@ -10,7 +10,7 @@ typedef struct QOSState QOSState;
 typedef struct QOSOps {
     QGuestAllocator *(*init_allocator)(QTestState *qts, QAllocOpts);
     void (*uninit_allocator)(QGuestAllocator *);
-    QPCIBus *(*qpci_init)(QTestState *qts, QGuestAllocator *alloc);
+    QPCIBus *(*qpci_new)(QTestState *qts, QGuestAllocator *alloc);
     void (*qpci_free)(QPCIBus *bus);
     void (*shutdown)(QOSState *);
 } QOSOps;
index a4fc02b5d8e8d67f69dc0e2ca451ede0c187fc2f..43d7082516902be2fb2c7a2a5050ba546f689f98 100644 (file)
@@ -116,7 +116,7 @@ static void qpci_pc_config_writel(QPCIBus *bus, int devfn, uint8_t offset, uint3
     qtest_outl(bus->qts, 0xcfc, value);
 }
 
-QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc)
+QPCIBus *qpci_new_pc(QTestState *qts, QGuestAllocator *alloc)
 {
     QPCIBusPC *ret = g_new0(QPCIBusPC, 1);
 
index 491eeac7562dd666eecbfea9964ee823afbf2122..5be68ba7de559760dc320c4a1fea6d0a5fc83f5d 100644 (file)
 #include "libqos/pci.h"
 #include "libqos/malloc.h"
 
-QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc);
+/* qpci_pc_new():
+ * @qts: The %QTestState for this PC machine
+ * @alloc: A previously initialized @alloc providing memory for @qts
+ *
+ * This function creates a new QPCIBusPC object,
+ * and properly initialize its fields.
+ *
+ * Returns a newly allocated QPCIBus.
+ */
+QPCIBus *qpci_new_pc(QTestState *qts, QGuestAllocator *alloc);
+
 void     qpci_free_pc(QPCIBus *bus);
 
 #endif
index 4c29889b0b80d2721b4cc98ad74671b3af4611bf..59679f6a927e103d44d0e7f07d32eb09fa0ba9a3 100644 (file)
@@ -160,7 +160,7 @@ static void qpci_spapr_config_writel(QPCIBus *bus, int devfn, uint8_t offset,
 #define SPAPR_PCI_MMIO32_WIN_SIZE    0x80000000 /* 2 GiB */
 #define SPAPR_PCI_IO_WIN_SIZE        0x10000
 
-QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc)
+QPCIBus *qpci_new_spapr(QTestState *qts, QGuestAllocator *alloc)
 {
     QPCIBusSPAPR *ret = g_new0(QPCIBusSPAPR, 1);
 
index 387686dfc8c0a18013f4000f45e642949def9367..177e8c002c5b3c452634f79ec94a28d0ca5f3f42 100644 (file)
@@ -11,7 +11,7 @@
 #include "libqos/malloc.h"
 #include "libqos/pci.h"
 
-QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc);
+QPCIBus *qpci_new_spapr(QTestState *qts, QGuestAllocator *alloc);
 void     qpci_free_spapr(QPCIBus *bus);
 
 #endif
index 7ea7acc9d87a9e9e6fcb27c19fbb0ba3e607be00..34b34bc2b984ac9d484eb8a407cfe7fc2c7fe68a 100644 (file)
@@ -87,7 +87,7 @@ static void test_smram_lock(void)
 
     qtest_start("-M q35");
 
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
 
     pcidev = qpci_device_find(pcibus, 0);
@@ -146,7 +146,7 @@ static void test_tseg_size(const void *data)
     g_free(cmdline);
 
     /* locate the DRAM controller */
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
     pcidev = qpci_device_find(pcibus, 0);
     g_assert(pcidev != NULL);
index 68bfc4217897e5af9c8d253a72446f2eff4fae45..a85c91f197457b0edb81de648fbe3a8f68907616 100644 (file)
@@ -35,7 +35,7 @@ static QPCIDevice *get_device(void)
 {
     QPCIDevice *dev;
 
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     qpci_device_foreach(pcibus, 0x10ec, 0x8139, save_fn, &dev);
     g_assert(dev != NULL);
 
index 982f5ebbb2acbbd43ef52f91b0466ccca2e2be39..28d481b62f032bdc3e1b73323db6e7bb958ca743 100644 (file)
@@ -187,7 +187,7 @@ static QSDHCI *machine_start(const struct sdhci_t *test)
         global_qtest = qtest_initf("-machine %s -device sdhci-pci",
                                    test->machine);
 
-        s->pci.bus = qpci_init_pc(global_qtest, NULL);
+        s->pci.bus = qpci_new_pc(global_qtest, NULL);
 
         /* Find PCI device and verify it's the right one */
         s->pci.dev = qpci_device_find(s->pci.bus, QPCI_DEVFN(4, 0));
index 6bee9a37d33990265f09b00668a484c6cd56118d..f89a42cdcc647a6bbc7e4b0d6cce7dadb6060a84 100644 (file)
@@ -64,7 +64,7 @@ static void test_init(TestData *d)
     global_qtest = qs;
     qtest_irq_intercept_in(qs, "ioapic");
 
-    d->bus = qpci_init_pc(qs, NULL);
+    d->bus = qpci_new_pc(qs, NULL);
     d->dev = qpci_device_find(d->bus, QPCI_DEVFN(0x1f, 0x00));
     g_assert(d->dev != NULL);
 
index f28ea27f37f48f7c957b2843c38aa47f50185ef2..8bc3e44189a44003112b5b69381cbfdb3771d4d9 100644 (file)
@@ -52,7 +52,7 @@ static void ehci_port_test(struct qhc *hc, int port, uint32_t expect)
 
 static void test_init(void)
 {
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
 
     qusb_pci_init_one(pcibus, &uhci1, QPCI_DEVFN(0x1d, 0), 4);
index 770e1e64846d9c43a58c1de7c1f46eea24cec6f7..611d3a79d8fb7f79b64b61d85e97b75a54e6b882 100644 (file)
@@ -197,7 +197,7 @@ static void init_virtio_dev(QTestState *qts, TestServer *s, uint32_t features_ma
     uint32_t features;
     int i;
 
-    s->bus = qpci_init_pc(qts, NULL);
+    s->bus = qpci_new_pc(qts, NULL);
     g_assert_nonnull(s->bus);
 
     s->dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET);