Skip to contentSkip to conversation

vhost-user-test: do not reinvent glib-compat.h

PATCH Superseded Paolo Bonzini 1 participant 1 message Sep 29, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user-test: do not reinvent glib-compat.h

glib-compat.h has the gunk to support both old-style and new-style gthread functions. Use it instead of reinventing it.

---
 memory.c                |  12 ++++-
 tests/vhost-user-test.c | 113 +++++++-----------------------------------------
 2 files changed, 26 insertions(+), 99 deletions(-)
memory.c +10 -2
index ef87363..1bfc8ba 100644
@@ -1304,7 +1304,14 @@ static void memory_region_finalize(Object *obj)
 {
     MemoryRegion *mr = MEMORY_REGION(obj);
 
-    assert(QTAILQ_EMPTY(&mr->subregions));
+    assert(!mr->container);
+    memory_region_transaction_begin();
+    while (!QTAILQ_EMPTY(&mr->subregions)) {
+        MemoryRegion *subregion = QTAILQ_FIRST(&mr->subregions);
+        memory_region_del_subregion(mr, subregion);
+    }
+    memory_region_transaction_commit();
+
     mr->destructor(mr);
     memory_region_clear_coalescing(mr);
     g_free((char *)mr->name);
@@ -1782,7 +1789,8 @@ void memory_region_del_subregion(MemoryRegion *mr,
     subregion->container = NULL;
     QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link);
     memory_region_unref(subregion);
-    memory_region_update_pending |= mr->enabled && subregion->enabled;
+    memory_region_update_pending |=
+        mr->container && mr->enabled && subregion->enabled;
     memory_region_transaction_commit();
 }
 
tests/vhost-user-test.c +16 -97

184 lines not on this page · raw message

Signature · 1 line
2.5.0