From nobody Mon Feb 9 10:30:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1643018898; cv=none; d=zohomail.com; s=zohoarc; b=BoH80nblrO2kfe1LeS6znCqdbhjU2bbGFbr6hPtKwXXNyJynpwo9pv0IixrSu90b7twSsnjWqbpar88jUrit90vtbiP90HYlHfEzb426hNe+tnDVkaqQPupRA9uPtWZxdqpz3hg27q+fywXU3g5Yxq2t0eS8g2g9pBFCTTeKocE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643018898; 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=k5oMl9Oo/Gz0dR7bM2vIw/GubfvzoAY3tLW7mG7Gl2M=; b=TmO61Bn2mu/bFVNWyM6TTx40k6IG6BQc+k0JAJNLUmuN7RgOB+8gRwBSeBqOJu0TtkBBXaGOgpwaUfwXMzMSKf1kkE1SD1DnCcu8szp66oj4KguH88xtDWViG0pjto6/d9exWRN1BKOKvY54j5iu+qyuc9wO4Bav9pyMnDexsx4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1643018898801937.4390224106525; Mon, 24 Jan 2022 02:08:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-Q0vZWQm3OdmM9SH7NZsgZQ-1; Mon, 24 Jan 2022 05:08:14 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB85B51081; Mon, 24 Jan 2022 10:08:09 +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 8322F73171; Mon, 24 Jan 2022 10:08:09 +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 EC2FE1809CB8; Mon, 24 Jan 2022 10:08:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20OA7lTb021063 for ; Mon, 24 Jan 2022 05:07:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 828B46F119; Mon, 24 Jan 2022 10:07:47 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA9066D03D for ; Mon, 24 Jan 2022 10:07:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643018898; 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=k5oMl9Oo/Gz0dR7bM2vIw/GubfvzoAY3tLW7mG7Gl2M=; b=WHj7WKNA2+xmdLEfsDlOvswMl2MsCOf9uQKydxQmEc0pMtod8x4UB01dpdjP6HDqo2+QlC FC4P5q2QgnZLPSBsZqiWTYDGXSZtt+Zkdo/rEUtZDItVv0gy2qifAQLwlss1WBoP9yLvB0 sXs5QodJYgb2G8Uu0yRiHJcbZGE84Qg= X-MC-Unique: Q0vZWQm3OdmM9SH7NZsgZQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 02/11] virDomainChrSourceDefCopy: Copy more struct members Date: Mon, 24 Jan 2022 11:07:24 +0100 Message-Id: <0791f09c3dcfb5a131ec98f1e3b3fdffe150ad54.1643018556.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 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: 1643018901482100001 Content-Type: text/plain; charset="utf-8" The aim of virDomainChrSourceDefCopy() is to make a deep copy of given virDomainChrSourceDef. However, some types were not copied at all (VIR_DOMAIN_CHR_TYPE_SPICEVMC and VIR_DOMAIN_CHR_TYPE_SPICEPORT) and some members weren't copied either (@logfile, @logappend). After this, there are still some members that are not copied (seclabels and private data), but the sole caller qemuProcessFindCharDevicePTYsMonitor() doesn't seem to care. Therefore, just document this behavior so that future user is aware. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 73c6ac6a88..5387cd271a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2731,8 +2731,9 @@ virDomainChrSourceDefClear(virDomainChrSourceDef *def) VIR_FREE(def->logfile); } =20 -/* Deep copies the contents of src into dest. Return -1 and report - * error on failure. */ +/* Almost deep copies the contents of src into dest. Some parts are not co= pied + * though. + * Returns -1 and report error on failure. */ int virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, virDomainChrSourceDef *src) @@ -2742,7 +2743,11 @@ virDomainChrSourceDefCopy(virDomainChrSourceDef *des= t, =20 virDomainChrSourceDefClear(dest); =20 - switch (src->type) { + dest->type =3D src->type; + dest->logfile =3D g_strdup(src->logfile); + dest->logappend =3D src->logappend; + + switch ((virDomainChrType)src->type) { case VIR_DOMAIN_CHR_TYPE_FILE: case VIR_DOMAIN_CHR_TYPE_PTY: case VIR_DOMAIN_CHR_TYPE_DEV: @@ -2782,10 +2787,22 @@ virDomainChrSourceDefCopy(virDomainChrSourceDef *de= st, dest->data.nmdm.slave =3D g_strdup(src->data.nmdm.slave); =20 break; + + case VIR_DOMAIN_CHR_TYPE_SPICEVMC: + dest->data.spicevmc =3D src->data.spicevmc; + break; + + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + dest->data.spiceport.channel =3D g_strdup(src->data.spiceport.chan= nel); + break; + + case VIR_DOMAIN_CHR_TYPE_NULL: + case VIR_DOMAIN_CHR_TYPE_VC: + case VIR_DOMAIN_CHR_TYPE_STDIO: + case VIR_DOMAIN_CHR_TYPE_LAST: + break; } =20 - dest->type =3D src->type; - return 0; } =20 --=20 2.34.1