From nobody Mon Feb 9 17:57:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1636043570; cv=none; d=zohomail.com; s=zohoarc; b=RtYI12TdBG2DNCe5q6c76AtO4AokVCQpetDHi3zu6TuCcgjzrPurvnUpxZ1T4OfCAjx0RWn/g91P1i5U3azSF1/eRaT1RLzeK5h7hY7HY1LDK3zk4GgQl3TEgE+3I7Gm80V6wnGJ0+XAx0l7mPADlPWjcRjPXlPSWB9mR3vdWBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636043570; h=Content-Type:Content-Transfer-Encoding:Cc: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=eghD3Bxy2yPtIhSI5t7SJPuOJ2fTk1sD5sXmC8o0zM0=; b=dqtOlI5m7irkxEubYOfySv9V+/+lIhLpByWncc4mHKJUUfjftbBDfK1dnAQshBQwO/mWvFhjpDomt74KwtuU8UeOHsdSZPKNWzaLqlIGv0OrtDqhnYnMCpgr6d2go/Arpz9Q0Deg5eb8/J/5Ydsx2ydTZpsve0FltwuT4lVw7Gs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163604357013125.881417643554073; Thu, 4 Nov 2021 09:32:50 -0700 (PDT) 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-28-0FTZ8RJ1MS-5dHpwpdD9Cw-1; Thu, 04 Nov 2021 12:32:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF8208066EB; Thu, 4 Nov 2021 16:32:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD151A6C42; Thu, 4 Nov 2021 16:32:40 +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 831CA4EA3B; Thu, 4 Nov 2021 16:32:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A4GRXOW026439 for ; Thu, 4 Nov 2021 12:27:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 25BE219D9F; Thu, 4 Nov 2021 16:27:33 +0000 (UTC) Received: from work.speedport.ip (unknown [10.39.193.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7197B19C79; Thu, 4 Nov 2021 16:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636043568; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=eghD3Bxy2yPtIhSI5t7SJPuOJ2fTk1sD5sXmC8o0zM0=; b=NvhOBgYzK/mM49Rq49+7W/pfDqbEdxkQ91PeXRshTx0Ar0ZGhULQSuOElxgYF2dWnuGCRo egSn6B47/zSqRiGwyMChqYWncPER7QkvZ1mzjsj3nrQrFboSw7AY3L5o8HynjzqQx3hXzi mZYuH3f9V0ZFu7I9GoA1WcMjcyXK1/8= X-MC-Unique: 0FTZ8RJ1MS-5dHpwpdD9Cw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 11/20] cpu: Add virCPUDataNewCopy Date: Thu, 4 Nov 2021 17:27:11 +0100 Message-Id: <20211104162720.108973-12-twiederh@redhat.com> In-Reply-To: <20211104162720.108973-1-twiederh@redhat.com> References: <20211104162720.108973-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.16 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) X-ZM-MESSAGEID: 1636043571462100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu.c | 21 +++++++++++++++++++++ src/cpu/cpu.h | 7 +++++++ src/libvirt_private.syms | 1 + 3 files changed, 29 insertions(+) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 0c1c7902f0..b5669246b4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -294,6 +294,27 @@ virCPUDataNew(virArch arch) } =20 =20 +/** + * virCPUDataNewCopy: + * + * Returns a copy of @data or NULL on error. + */ +virCPUData * +virCPUDataNewCopy(virCPUData *data) +{ + struct cpuArchDriver *driver; + + VIR_DEBUG("data=3D%p", data); + + if (!data) + return NULL; + + if ((driver =3D cpuGetSubDriver(data->arch)) && driver->dataCopyNew) + return driver->dataCopyNew(data); + + return NULL; +} + /** * virCPUDataFree: * diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 7ecb0d6921..d3e5ca79f2 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -62,6 +62,9 @@ typedef int virCPUData **forbidden, virCPUData **vendor); =20 +typedef virCPUData * +(*cpuArchDataCopyNew)(virCPUData *data); + typedef void (*cpuArchDataFree) (virCPUData *data); =20 @@ -134,6 +137,7 @@ struct cpuArchDriver { virCPUArchCompare compare; cpuArchDecode decode; cpuArchEncode encode; + cpuArchDataCopyNew dataCopyNew; cpuArchDataFree dataFree; virCPUArchGetHost getHost; virCPUArchBaseline baseline; @@ -188,6 +192,9 @@ cpuEncode (virArch arch, virCPUData * virCPUDataNew(virArch arch); =20 +virCPUData * +virCPUDataNewCopy(virCPUData *data); + void virCPUDataFree(virCPUData *data); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUData, virCPUDataFree); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3b6645b4a8..665db255a6 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1462,6 +1462,7 @@ virCPUDataFormat; virCPUDataFree; virCPUDataIsIdentical; virCPUDataNew; +virCPUDataNewCopy; virCPUDataParse; virCPUDataParseNode; virCPUExpandFeatures; --=20 2.31.1