Now that the domCaps cache is history, this code is no longer used and thus can be removed. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 129 ----------------------------------- src/qemu/qemu_capabilities.h | 10 --- 2 files changed, 139 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 212ddf9206..9f9f976754 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -648,25 +648,6 @@ struct _virQEMUCapsAccel { }; -typedef struct _virQEMUDomainCapsCache virQEMUDomainCapsCache; -typedef virQEMUDomainCapsCache *virQEMUDomainCapsCachePtr; -struct _virQEMUDomainCapsCache { - virObjectLockable parent; - - GHashTable *cache; -}; - -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDomainCapsCache, virObjectUnref); - -static virClassPtr virQEMUDomainCapsCacheClass; -static void virQEMUDomainCapsCacheDispose(void *obj) -{ - virQEMUDomainCapsCachePtr cache = obj; - - virHashFree(cache->cache); -} - - /* * Update the XML parser/formatter when adding more * information to this struct so that it gets cached @@ -700,8 +681,6 @@ struct _virQEMUCaps { virArch arch; - virQEMUDomainCapsCachePtr domCapsCache; - size_t ngicCapabilities; virGICCapability *gicCapabilities; @@ -726,9 +705,6 @@ static int virQEMUCapsOnceInit(void) if (!VIR_CLASS_NEW(virQEMUCaps, virClassForObject())) return -1; - if (!(VIR_CLASS_NEW(virQEMUDomainCapsCache, virClassForObjectLockable()))) - return -1; - return 0; } @@ -1774,24 +1750,6 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps, } -static virQEMUDomainCapsCachePtr -virQEMUDomainCapsCacheNew(void) -{ - g_autoptr(virQEMUDomainCapsCache) cache = NULL; - - if (virQEMUCapsInitialize() < 0) - return NULL; - - if (!(cache = virObjectLockableNew(virQEMUDomainCapsCacheClass))) - return NULL; - - if (!(cache->cache = virHashNew(virObjectFreeHashData))) - return NULL; - - return g_steal_pointer(&cache); -} - - virQEMUCapsPtr virQEMUCapsNew(void) { @@ -1806,14 +1764,7 @@ virQEMUCapsNew(void) qemuCaps->invalidation = true; qemuCaps->flags = virBitmapNew(QEMU_CAPS_LAST); - if (!(qemuCaps->domCapsCache = virQEMUDomainCapsCacheNew())) - goto error; - return qemuCaps; - - error: - virObjectUnref(qemuCaps); - return NULL; } @@ -1992,7 +1943,6 @@ void virQEMUCapsDispose(void *obj) { virQEMUCapsPtr qemuCaps = obj; - virObjectUnref(qemuCaps->domCapsCache); virBitmapFree(qemuCaps->flags); VIR_FREE(qemuCaps->package); @@ -2147,85 +2097,6 @@ const char *virQEMUCapsGetPackage(virQEMUCapsPtr qemuCaps) } -struct virQEMUCapsSearchDomcapsData { - const char *path; - const char *machine; - virArch arch; - virDomainVirtType virttype; -}; - - -static int -virQEMUCapsSearchDomcaps(const void *payload, - const char *name G_GNUC_UNUSED, - const void *opaque) -{ - virDomainCapsPtr domCaps = (virDomainCapsPtr) payload; - struct virQEMUCapsSearchDomcapsData *data = (struct virQEMUCapsSearchDomcapsData *) opaque; - - if (STREQ_NULLABLE(data->path, domCaps->path) && - STREQ_NULLABLE(data->machine, domCaps->machine) && - data->arch == domCaps->arch && - data->virttype == domCaps->virttype) - return 1; - - return 0; -} - - -virDomainCapsPtr -virQEMUCapsGetDomainCapsCache(virQEMUCapsPtr qemuCaps, - const char *machine, - virArch arch, - virDomainVirtType virttype, - virArch hostarch, - bool privileged, - virFirmwarePtr *firmwares, - size_t nfirmwares) -{ - virQEMUDomainCapsCachePtr cache = qemuCaps->domCapsCache; - virDomainCapsPtr domCaps = NULL; - const char *path = virQEMUCapsGetBinary(qemuCaps); - struct virQEMUCapsSearchDomcapsData data = { - .path = path, - .machine = machine, - .arch = arch, - .virttype = virttype, - }; - - virObjectLock(cache); - - domCaps = virHashSearch(cache->cache, virQEMUCapsSearchDomcaps, &data, NULL); - - if (!domCaps) { - g_autoptr(virDomainCaps) tempDomCaps = NULL; - g_autofree char *key = NULL; - - /* hash miss, build new domcaps */ - if (!(tempDomCaps = virDomainCapsNew(path, machine, - arch, virttype))) - goto cleanup; - - if (virQEMUCapsFillDomainCaps(qemuCaps, hostarch, tempDomCaps, - privileged, firmwares, nfirmwares) < 0) - goto cleanup; - - key = g_strdup_printf("%d:%d:%s:%s", arch, virttype, - NULLSTR(machine), path); - - if (virHashAddEntry(cache->cache, key, tempDomCaps) < 0) - goto cleanup; - - domCaps = g_steal_pointer(&tempDomCaps); - } - - virObjectRef(domCaps); - cleanup: - virObjectUnlock(cache); - return domCaps; -} - - int virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps, virDomainVirtType type, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 6b40ff4f15..9d3f73b2ab 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -620,16 +620,6 @@ virArch virQEMUCapsGetArch(virQEMUCapsPtr qemuCaps); unsigned int virQEMUCapsGetVersion(virQEMUCapsPtr qemuCaps); const char *virQEMUCapsGetPackage(virQEMUCapsPtr qemuCaps); -virDomainCapsPtr -virQEMUCapsGetDomainCapsCache(virQEMUCapsPtr qemuCaps, - const char *machine, - virArch arch, - virDomainVirtType virttype, - virArch hostarch, - bool privileged, - virFirmwarePtr *firmwares, - size_t nfirmwares); - unsigned int virQEMUCapsGetKVMVersion(virQEMUCapsPtr qemuCaps); int virQEMUCapsAddCPUDefinitions(virQEMUCapsPtr qemuCaps, virDomainVirtType type, -- 2.26.2