From nobody Tue Feb 10 01:15:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1605512707; cv=none; d=zohomail.com; s=zohoarc; b=V2vQyR78UdicIFF0asAw4ifdL9NMrhe2bM59AUqAygGp16++dITpDZ/i6RE/EzBNruaykL+VhquvX7qfb5Gfo2sZZHaMhb81Dmi3sHWqy1VerXdKKPSzoYzgE4zNzsd1V3FMmrNhr5zO/UV1Ah2LuqhSGH/QXHome1h1TXy1gb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605512707; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4I9sGvD7J3DJBS3W1uJItYyMhjSGTkNsKzq/LYVp3io=; b=j1Zfea3Ax2peqxA1Zq1D0Fz5tN+aVHANrc7fBHrJ3ErImi45Fl/Xf0QaupMEg/i0KDjs3zbVnfUXFixx6vF71a6OSGns721cjZU9xsky3HXVx62W8ze7HvcGKR//odbNIQEYe73hBVr1mZFGM3WRUqNlZAiXx/tj4hN91zxn5Lo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605512707836692.2844203969435; Sun, 15 Nov 2020 23:45:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-560-zJSDiwcnNuWCXRDR1ZiDSw-1; Mon, 16 Nov 2020 02:44:11 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D6DB188C12C; Mon, 16 Nov 2020 07:44:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 020E351919; Mon, 16 Nov 2020 07:44:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B7F71181A07B; Mon, 16 Nov 2020 07:44:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AG7hs7i032575 for ; Mon, 16 Nov 2020 02:43:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0130B5B4BF; Mon, 16 Nov 2020 07:43:54 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75BD95B4A9 for ; Mon, 16 Nov 2020 07:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605512706; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4I9sGvD7J3DJBS3W1uJItYyMhjSGTkNsKzq/LYVp3io=; b=gNQFU5gzIYzHuan+o3YI5zgZbvQ6/8S/clTIdH3LH6Hg8lmSrGdPHAswbJNXBDJE/PqsN2 eC7Mnk4GMAdAp1VjSGIhjcx3GoUw/Ar9JvQcTKwjmhsiLTGDns9r9y9+si2VsbcvXm041S Oo0toQgH+DNa6a9BCSwxLamYhq/AjkY= X-MC-Unique: zJSDiwcnNuWCXRDR1ZiDSw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/5] qemu: Remove virQEMUDomainCapsCache code Date: Mon, 16 Nov 2020 08:43:44 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that the domCaps cache is history, this code is no longer used and thus can be removed. Signed-off-by: Michal Privoznik --- 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 { }; =20 =20 -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 =3D 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 { =20 virArch arch; =20 - virQEMUDomainCapsCachePtr domCapsCache; - size_t ngicCapabilities; virGICCapability *gicCapabilities; =20 @@ -726,9 +705,6 @@ static int virQEMUCapsOnceInit(void) if (!VIR_CLASS_NEW(virQEMUCaps, virClassForObject())) return -1; =20 - if (!(VIR_CLASS_NEW(virQEMUDomainCapsCache, virClassForObjectLockable(= )))) - return -1; - return 0; } =20 @@ -1774,24 +1750,6 @@ int virQEMUCapsGetDefaultVersion(virCapsPtr caps, } =20 =20 -static virQEMUDomainCapsCachePtr -virQEMUDomainCapsCacheNew(void) -{ - g_autoptr(virQEMUDomainCapsCache) cache =3D NULL; - - if (virQEMUCapsInitialize() < 0) - return NULL; - - if (!(cache =3D virObjectLockableNew(virQEMUDomainCapsCacheClass))) - return NULL; - - if (!(cache->cache =3D virHashNew(virObjectFreeHashData))) - return NULL; - - return g_steal_pointer(&cache); -} - - virQEMUCapsPtr virQEMUCapsNew(void) { @@ -1806,14 +1764,7 @@ virQEMUCapsNew(void) qemuCaps->invalidation =3D true; qemuCaps->flags =3D virBitmapNew(QEMU_CAPS_LAST); =20 - if (!(qemuCaps->domCapsCache =3D virQEMUDomainCapsCacheNew())) - goto error; - return qemuCaps; - - error: - virObjectUnref(qemuCaps); - return NULL; } =20 =20 @@ -1992,7 +1943,6 @@ void virQEMUCapsDispose(void *obj) { virQEMUCapsPtr qemuCaps =3D obj; =20 - virObjectUnref(qemuCaps->domCapsCache); virBitmapFree(qemuCaps->flags); =20 VIR_FREE(qemuCaps->package); @@ -2147,85 +2097,6 @@ const char *virQEMUCapsGetPackage(virQEMUCapsPtr qem= uCaps) } =20 =20 -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 =3D (virDomainCapsPtr) payload; - struct virQEMUCapsSearchDomcapsData *data =3D (struct virQEMUCapsSearc= hDomcapsData *) opaque; - - if (STREQ_NULLABLE(data->path, domCaps->path) && - STREQ_NULLABLE(data->machine, domCaps->machine) && - data->arch =3D=3D domCaps->arch && - data->virttype =3D=3D 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 =3D qemuCaps->domCapsCache; - virDomainCapsPtr domCaps =3D NULL; - const char *path =3D virQEMUCapsGetBinary(qemuCaps); - struct virQEMUCapsSearchDomcapsData data =3D { - .path =3D path, - .machine =3D machine, - .arch =3D arch, - .virttype =3D virttype, - }; - - virObjectLock(cache); - - domCaps =3D virHashSearch(cache->cache, virQEMUCapsSearchDomcaps, &dat= a, NULL); - - if (!domCaps) { - g_autoptr(virDomainCaps) tempDomCaps =3D NULL; - g_autofree char *key =3D NULL; - - /* hash miss, build new domcaps */ - if (!(tempDomCaps =3D virDomainCapsNew(path, machine, - arch, virttype))) - goto cleanup; - - if (virQEMUCapsFillDomainCaps(qemuCaps, hostarch, tempDomCaps, - privileged, firmwares, nfirmwares) <= 0) - goto cleanup; - - key =3D g_strdup_printf("%d:%d:%s:%s", arch, virttype, - NULLSTR(machine), path); - - if (virHashAddEntry(cache->cache, key, tempDomCaps) < 0) - goto cleanup; - - domCaps =3D 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); =20 -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, --=20 2.26.2