From nobody Sun Apr 28 18:49:51 2024 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=1678094444; cv=none; d=zohomail.com; s=zohoarc; b=QrPPqxudu8eG4aa8xBMO+3c57QbTxLHYdiEYii1cKPKLiPrwKSrQOyc5H2tT4c5p1JMcar3A2StITp+hItB8ac2LFJ1O/KL9SM2izxDqP6bW4anu33+ObzNw6/XZhKkCra+7ruufJqwqaC9sRGcoqq+IDrGQrr156GqvwvWgNPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094444; 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=KmcQb9vO0+MjCJ1y/3QgutvXYu5Ja4iI4ZJqZIQWwN0=; b=eXU9qb0b8YJfWxbBGoL64uxCKk2Ud5jjlfLPfiXoFAwH1HBOuq7JHjKLaSB/jUaTH+0I/PFDsoll8Ess0zMEEMU7It1Y1RE+Tgt/TsOAbto7n0s6fXhBs+J/z1zOrT9D2equMVTDOJ/3hKH2kVBn4TNYAcN0+Of1iKRRcO4npZc= 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 1678094444876572.7225420482256; Mon, 6 Mar 2023 01:20:44 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-214-xa1B3e4yNJyvRAcYH04YLw-1; Mon, 06 Mar 2023 04:20:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 97AC2857AA2; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8489BC16029; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 658BC194658C; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1D9B61946586 for ; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 10D75112132D; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8582D1121314 for ; Mon, 6 Mar 2023 09:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094443; 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=KmcQb9vO0+MjCJ1y/3QgutvXYu5Ja4iI4ZJqZIQWwN0=; b=Fv81enVT74gNZfSqCu/DMtcu0YYJ23Rbp0+dwFCIlG7LJxsMBryzVD3FHSZOTMQtU3sDh3 ZSM0lKvKFg2c+f5th+UGmOrbsuqmbe6SX9gVACbHz3/0QdLsRxQLyAKH7ukduO3Vlsp2zi 0W6/OUSetbolkhTQG46VmvItfisSv/c= X-MC-Unique: xa1B3e4yNJyvRAcYH04YLw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] qemuBuildHostNetProps: Report proper errors for unhandled interface types Date: Mon, 6 Mar 2023 10:20:30 +0100 Message-Id: <61909b67562f174a5409af64d1091ced93758cb8.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1678094446362100002 Content-Type: text/plain; charset="utf-8" VIR_DOMAIN_NET_TYPE_NULL and VIR_DOMAIN_NET_TYPE_VDS are not implemented for the qemu driver but the formatter code in 'qemuBuildHostNetProps' didn't report an error for them and didn't even return from the function when they were encountered. This caused a crash in 'virJSONValueObjectAppendStringPrintf' which does not tolerate NULL JSON object to append to when the unsupported devices were used. Properly report error when unhandled devices are encountered. This also includes the case for VIR_DOMAIN_NET_TYPE_HOSTDEV, but that code path should never be reached. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2175582 Fixes: 6457619d186 Fixes: 0225483adce Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4839d45a34..589ec3e639 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3995,8 +3995,14 @@ qemuBuildHostNetProps(virDomainObj *vm, /* Should have been handled earlier via PCI/USB hotplug code. */ case VIR_DOMAIN_NET_TYPE_NULL: case VIR_DOMAIN_NET_TYPE_VDS: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("network device type '%s' is not supported by thi= s hypervisor"), + virDomainNetTypeToString(netType)); + return NULL; + case VIR_DOMAIN_NET_TYPE_LAST: - break; + virReportEnumRangeError(virDomainNetType, netType); + return NULL; } if (virJSONValueObjectAppendStringPrintf(netprops, "id", "host%s", net= ->info.alias) < 0) --=20 2.39.2 From nobody Sun Apr 28 18:49:51 2024 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=1678094524; cv=none; d=zohomail.com; s=zohoarc; b=mzgeATf48VBfS4iTv4IXsrPzTX/65qk1ggku1DtzOdMfj4+6FHwwaSD5sC0rL8CMO01YeWKho8KmRxZkGys5/ydG/LOq+k9D75GecwLWiWYg2AYMtqaEUrj5nzBP8Y0mONA8Xk5X7Ae0TRhRapYbyHI5OTGq/+xbCkXLzJC5F/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094524; 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=eG7tCMEG9AyK5XV0NXdRSVHOIa8Y+oC7GQfNZhSyxUA=; b=XwRPBrFVkOAUR6xv0Ju33sRDq9QLP6mywgbX8PqTfYzuKy7bk+6ey+79i37B2501s2KOV1uSm647/xIsJw0D+5XkhJlPnNyiuOeku3y0Ft5F6xcfb8snhe7LvT0EZ0V8H8pe/eGV95ZShpH2nTrnYhZ7cZZ3o9Qzk0rpxB+184I= 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 1678094524798880.6488001515918; Mon, 6 Mar 2023 01:22:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-646-uAsOGPpxNIS4O0HdcZKo5g-1; Mon, 06 Mar 2023 04:20:43 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A0DD100F919; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00D4C440DE; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A00D619465B8; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0864A1946586 for ; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D3F4B112132D; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5ADF91121314 for ; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094523; 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=eG7tCMEG9AyK5XV0NXdRSVHOIa8Y+oC7GQfNZhSyxUA=; b=bPhkcLfqBYoKavE7kftevLNQOJq81/+Y1hnt+bc+I+82XzVa8wbDysIAf2tECEaNNg1/TU 6a4/yxI3VAHo6m8vbED1QUbVpppI6desSOJsDdMzfFFuxj5g68dD/LeGusFN4LJA72ayHH wuJRBhsZ6308fPtB+obpbchDGKsNrfs= X-MC-Unique: uAsOGPpxNIS4O0HdcZKo5g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/6] qemuBuildHostNetProps: Don't use virJSONValueObjectAppendStringPrintf to format address Date: Mon, 6 Mar 2023 10:20:31 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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: 1678094525969100001 Content-Type: text/plain; charset="utf-8" Prefer virJSONValueObjectAdd which we already use internally combined with local formatting of the string. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 68 +++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 589ec3e639..784003fbf5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3804,6 +3804,15 @@ qemuBuildNicDevProps(virDomainDef *def, } +static char * +qemuBuildHostNetSocketAddr(virDomainNetDef *net) +{ + return g_strdup_printf("%s:%d", + NULLSTR_EMPTY(net->data.socket.address), + net->data.socket.port); +} + + virJSONValue * qemuBuildHostNetProps(virDomainObj *vm, virDomainNetDef *net) @@ -3885,40 +3894,53 @@ qemuBuildHostNetProps(virDomainObj *vm, } break; - case VIR_DOMAIN_NET_TYPE_CLIENT: - if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0= || - virJSONValueObjectAppendStringPrintf(netprops, "connect", "%s:= %d", - net->data.socket.address, - net->data.socket.port) < = 0) + case VIR_DOMAIN_NET_TYPE_CLIENT: { + g_autofree char *addr =3D qemuBuildHostNetSocketAddr(net); + + if (virJSONValueObjectAdd(&netprops, + "s:type", "socket", + "s:connect", addr, + NULL) < 0) return NULL; break; + } - case VIR_DOMAIN_NET_TYPE_SERVER: - if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0= || - virJSONValueObjectAppendStringPrintf(netprops, "listen", "%s:%= d", - NULLSTR_EMPTY(net->data.s= ocket.address), - net->data.socket.port) < = 0) + case VIR_DOMAIN_NET_TYPE_SERVER: { + g_autofree char *addr =3D qemuBuildHostNetSocketAddr(net); + + if (virJSONValueObjectAdd(&netprops, + "s:type", "socket", + "s:listen", addr, + NULL) < 0) return NULL; break; + } - case VIR_DOMAIN_NET_TYPE_MCAST: - if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0= || - virJSONValueObjectAppendStringPrintf(netprops, "mcast", "%s:%d= ", - net->data.socket.address, - net->data.socket.port) < = 0) + case VIR_DOMAIN_NET_TYPE_MCAST: { + g_autofree char *addr =3D qemuBuildHostNetSocketAddr(net); + + if (virJSONValueObjectAdd(&netprops, + "s:type", "socket", + "s:mcast", addr, + NULL) < 0) return NULL; break; + } - case VIR_DOMAIN_NET_TYPE_UDP: - if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0= || - virJSONValueObjectAppendStringPrintf(netprops, "udp", "%s:%d", - net->data.socket.address, - net->data.socket.port) < = 0 || - virJSONValueObjectAppendStringPrintf(netprops, "localaddr", "%= s:%d", - net->data.socket.localadd= r, - net->data.socket.localpor= t) < 0) + case VIR_DOMAIN_NET_TYPE_UDP: { + g_autofree char *addr =3D qemuBuildHostNetSocketAddr(net); + g_autofree char *localaddr =3D g_strdup_printf("%s:%d", + net->data.socket.loca= laddr, + net->data.socket.loca= lport); + + if (virJSONValueObjectAdd(&netprops, + "s:type", "socket", + "s:udp", addr, + "s:localaddr", localaddr, + NULL) < 0) return NULL; break; + } case VIR_DOMAIN_NET_TYPE_USER: if (net->backend.type =3D=3D VIR_DOMAIN_NET_BACKEND_PASST) { --=20 2.39.2 From nobody Sun Apr 28 18:49:51 2024 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=1678094469; cv=none; d=zohomail.com; s=zohoarc; b=QJtBRv0kv5reGVlHPA0c7A6qyv0OQfXTU5hp2UYib8uD//erP1FoEeNFICF18TxFBo1mAdTmLFmJxwuHEB2mXUdhUreM8lJKb5PjIYkRYcRVjdERmXMbRxu8MGAD+DNbPNA//7BMm3wRE0hQLNgBmSA32tmZ+Ta5Bo+BAqXzMc4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094469; 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=8AfRozz1ECd5XgSdoT8Gu3rAI7EVodkQKYIlvgajh2U=; b=VH7zUcVqm3ffr64S5VE57K0gXF96SBA+WQL/nqjz3jsTn3kXiS0pA6KH9zQdNvajj+IqN9AJwIxPzkkhP5i/NpAOcV4H2KWxWxoT3j7qoeFijFp5m4i+fuzBOJSsG5kxFIMofZr5Jlo5RwtCGDUgBomGqhfH9EH/CyZMMrjAwR0= 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 1678094469314386.50987425838935; Mon, 6 Mar 2023 01:21:09 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-NVCOj-GMMKGdzPQhud4wKw-1; Mon, 06 Mar 2023 04:20:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D9363C18353; Mon, 6 Mar 2023 09:20:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B04340C10FA; Mon, 6 Mar 2023 09:20:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ED308194658C; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C30ED19465B3 for ; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B77CF112132E; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BC161121314 for ; Mon, 6 Mar 2023 09:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094468; 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=8AfRozz1ECd5XgSdoT8Gu3rAI7EVodkQKYIlvgajh2U=; b=Vo2f11HuZGM0HZasFsfhQYcd9kCtbERhwvEMYdruj4ceSXwox6kpum40OMPBtKQsdF5sjF fI7oCpOnJDaLNfco/bWNTL9uv8HuPLlw4HZhybEMZc78Yoo28j+uFg3o/i01+iqed0RefZ FaG2B+Jcpmdmve+qIlQ7LGn1B216IC8= X-MC-Unique: NVCOj-GMMKGdzPQhud4wKw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] qemuBuildChannelGuestfwdNetdevProps: Don't use virJSONValueObjectAppendStringPrintf Date: Mon, 6 Mar 2023 10:20:32 +0100 Message-Id: <354e74507e266de5d1a1cae0c4451b72695c552e.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678094470745100001 Content-Type: text/plain; charset="utf-8" Use virJSONValueObjectAdd and format the string directly via g_strdup_printf. In the end virJSONValueObjectAppendStringPrintf will be removed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 784003fbf5..420fe4ed0c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10475,22 +10475,24 @@ qemuBuildParallelChrDeviceProps(virDomainChrDef *= chr) virJSONValue * qemuBuildChannelGuestfwdNetdevProps(virDomainChrDef *chr) { + g_autofree char *guestfwdstr =3D NULL; + g_autoptr(virJSONValue) guestfwdstrobj =3D NULL; g_autoptr(virJSONValue) guestfwdarr =3D virJSONValueNewArray(); - g_autoptr(virJSONValue) guestfwdstrobj =3D virJSONValueNewObject(); g_autofree char *addr =3D NULL; virJSONValue *ret =3D NULL; if (!(addr =3D virSocketAddrFormat(chr->target.addr))) return NULL; + guestfwdstr =3D g_strdup_printf("tcp:%s:%i-chardev:char%s", + addr, + virSocketAddrGetPort(chr->target.addr), + chr->info.alias); + /* this may seem weird, but qemu indeed decided that 'guestfwd' parame= ter * is an array of objects which have just one member named 'str' which * contains the description */ - if (virJSONValueObjectAppendStringPrintf(guestfwdstrobj, "str", - "tcp:%s:%i-chardev:char%s", - addr, - virSocketAddrGetPort(chr->tar= get.addr), - chr->info.alias) < 0) + if (virJSONValueObjectAdd(&guestfwdstrobj, "s:str", guestfwdstr, NULL)= < 0) return NULL; if (virJSONValueArrayAppend(guestfwdarr, &guestfwdstrobj) < 0) --=20 2.39.2 From nobody Sun Apr 28 18:49:51 2024 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=1678094448; cv=none; d=zohomail.com; s=zohoarc; b=UMDUvZmhUX/RAX6egX6G4SAjj4ISeUZQRz7zH2W8KWMUEGRLLLnhXUKBLFgMSfyza3et3YRBnc9LwVVfC4iQPbeP6T28j4RDtQNlbl9H4DWVhPtwdIMU0ST0x0jOA8m6B9r8t4rqdwOyijItY79//VDEKJS3BAq19y644398zTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094448; 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=0UVLueAXCB0PqaDYO2JDCNz+9ISEYpOk+kp0LM7V0ws=; b=eO8TBu/D7rYZEnaWgRds2vkZkSmh8lD8wNv51O5p8M95O1GnV1TrJHcsPvZuRh13oEYTDKtW6tT+QmbeInF9351CbhaNh7DCq0bsKMMvtCXcjkp7oTEz6/QOThYsRvQGIK+RrAl/2Cezn8R372xSZ/G6uNhK29rQ2KzbE1akEoM= 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 1678094448827415.2253487548285; Mon, 6 Mar 2023 01:20:48 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-136-iVfNvx4FPC2OO6wVYwBxvw-1; Mon, 06 Mar 2023 04:20:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5BD313C20EE5; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 495C040CF8F0; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2BA8B194658C; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 984891946586 for ; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8684A1121314; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E5F3112132D for ; Mon, 6 Mar 2023 09:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094447; 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=0UVLueAXCB0PqaDYO2JDCNz+9ISEYpOk+kp0LM7V0ws=; b=BiJnqRGspmt+aRMj3z+EvkDfRAan00C6l0NzID7sy5vNvOvdaesauqArsNj0VqdzKHUFEK Oh9WbKcsgHmuQK38oYqM+e6pLzYNuP8zwbG9XoriOZKpINDq+1hgYfs/Z2UXfjl17tTrvd gHsHcGCIZFh/44hVUsPKJMyBz56p5uM= X-MC-Unique: iVfNvx4FPC2OO6wVYwBxvw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] qemuBuildHostNetProps: Append ipv6 address using virJSONValueObjectAdd Date: Mon, 6 Mar 2023 10:20:33 +0100 Message-Id: <04fab0e5851e16e85883b0fd09d269aa0f838523.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1678094450568100002 Content-Type: text/plain; charset="utf-8" The 'ipv6-prefix' and 'ipv6-prefixlen' fields can be directly added using virJSONValueObjectAdd rather tha by two separate calls. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 420fe4ed0c..1fc235153e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3974,11 +3974,10 @@ qemuBuildHostNetProps(virDomainObj *vm, if (virJSONValueObjectAppendString(netprops, "net", ip= v4netaddr) < 0) return NULL; } else if (VIR_SOCKET_ADDR_IS_FAMILY(&ip->address, AF_INET= 6)) { - if (virJSONValueObjectAppendString(netprops, "ipv6-pre= fix", addr) < 0) - return NULL; - if (ip->prefix && - virJSONValueObjectAppendNumberUlong(netprops, "ipv= 6-prefixlen", - ip->prefix) < = 0) + if (virJSONValueObjectAdd(&netprops, + "s:ipv6-prefix", addr, + "p:ipv6-prefixlen", ip->pref= ix, + NULL) < 0) return NULL; } } --=20 2.39.2 From nobody Sun Apr 28 18:49:51 2024 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=1678094449; cv=none; d=zohomail.com; s=zohoarc; b=OAN9JSwccZOOohThYsW3E06JexWe714VZkil3g6eAv4fdiVVr0fBvNNOkgs7wogcrml30FnsTcxfS1Lvs5XqigQpeBWHOFIFxlOLydX+cs8vcAN4KKhs6ydrHqcLFWo/5BKQPpkx3TZK3TmUHOk12I3mXaOyrr+7yucVzoW2gqU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094449; 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=faPuCS+RYnBO2EdtRzSG+k04H7dtcNAZkdGokPQdLYk=; b=iw5KRm2Y4WQyx/IRxayPaVQ3glLAu8byX/SdNap2zzRKPMNIBKbefWvcV2Hvikuy5cz1S2o5IHz0Bjk3/rHDJD3wl6Silfd+5XS+fZffWxu3/bknLeeqoRkAyQhYUV44ZQ9CNxpI0vp+czIxIVh468ZyLaELPOHhAbP44fDL3RM= 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 1678094449573756.3101188808416; Mon, 6 Mar 2023 01:20:49 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-344-DYHZebCqO5mPmWBSECYFQw-1; Mon, 06 Mar 2023 04:20:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0307857A84; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA2F52166B2C; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9BAFC194658F; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7064C194658D for ; Mon, 6 Mar 2023 09:20:41 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 636ED1121330; Mon, 6 Mar 2023 09:20:41 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3F0B112132D for ; Mon, 6 Mar 2023 09:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094448; 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=faPuCS+RYnBO2EdtRzSG+k04H7dtcNAZkdGokPQdLYk=; b=HZfNk/7IcTDRhbYv1GvnJSkisPk6w7vUoYmMeRc5oVFPFlKKskHTZ5qNBF5NlGuz/eWezW h5aoxWrSZG9I+fd4zTuGl0tA73vTfseGgvD4/UnTCD0Zt9+Y36pAAtLlcI/m37+C1EfQB/ as2DSiuFBe83OsYEovBnnL5xTGZDCDI= X-MC-Unique: DYHZebCqO5mPmWBSECYFQw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] qemuBuildHostNetProps: Append aliases without virJSONValueObjectAppendStringPrintf Date: Mon, 6 Mar 2023 10:20:34 +0100 Message-Id: <0e7ca48af3130cd457ef6f7efadb41b549269092.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1678094450566100001 Content-Type: text/plain; charset="utf-8" Format aliases into temporary strings and append them using virJSONValueObjectAdd. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1fc235153e..e5c093e7ea 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3821,6 +3821,7 @@ qemuBuildHostNetProps(virDomainObj *vm, size_t i; qemuDomainNetworkPrivate *netpriv =3D QEMU_DOMAIN_NETWORK_PRIVATE(net); g_autoptr(virJSONValue) netprops =3D NULL; + g_autofree char *alias =3D g_strdup_printf("host%s", net->info.alias); if (net->script && netType !=3D VIR_DOMAIN_NET_TYPE_ETHERNET) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3989,15 +3990,20 @@ qemuBuildHostNetProps(virDomainObj *vm, return NULL; break; - case VIR_DOMAIN_NET_TYPE_VHOSTUSER: - if (virJSONValueObjectAdd(&netprops, "s:type", "vhost-user", NULL)= < 0 || - virJSONValueObjectAppendStringPrintf(netprops, "chardev", "cha= r%s", net->info.alias) < 0) + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: { + g_autofree char *charalias =3D g_strdup_printf("char%s", net->info= .alias); + + if (virJSONValueObjectAdd(&netprops, + "s:type", "vhost-user", + "s:chardev", charalias, + NULL) < 0) return NULL; if (net->driver.virtio.queues > 1 && virJSONValueObjectAppendNumberUlong(netprops, "queues", net->d= river.virtio.queues) < 0) return NULL; break; + } case VIR_DOMAIN_NET_TYPE_VDPA: /* Caller will pass the fd to qemu with add-fd */ @@ -4026,7 +4032,7 @@ qemuBuildHostNetProps(virDomainObj *vm, return NULL; } - if (virJSONValueObjectAppendStringPrintf(netprops, "id", "host%s", net= ->info.alias) < 0) + if (virJSONValueObjectAdd(&netprops, "s:id", alias, NULL) < 0) return NULL; return g_steal_pointer(&netprops); --=20 2.39.2 From nobody Sun Apr 28 18:49:51 2024 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=1678094528; cv=none; d=zohomail.com; s=zohoarc; b=m9ecbeoKR5ofw8dcjJb+Y/dtt/xwYUvwjiODMd/jtHm+lVpT8Tzj8HViAsNdk11NO3+xgWMzTzItseO006ggWfhJESO1qfylgaQvfElQLrwMkE+HLVqv7ToUe/oTxTkSQy6qc5mKX/eh9IGYMO6uq1bkLZrikWZOizp+F5DHZnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678094528; 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=/lgpRTiLnhC3yx4AsJZga+kCzHquhITn8eCpMTpQcsY=; b=g+/axQ2Y1bZtvOUt3peNQpUIGzUs8sq0ngBDAV9D4fxCkv1Ljn/cwTXHZDUNYT5qFxrc1cTiQhwQtqdQC1fWDmDA7upaZ7/xU7AJvyFwt2q5ur6kmQHijYci31lNwpnRDQ8kMNjcDVf6MY6l6W1SqTmXdgIWBH2RJ7bf/lhBJu0= 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 1678094528408348.34869848533185; Mon, 6 Mar 2023 01:22:08 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-399-8HmWpA6mPB2b2MJ055VcYA-1; Mon, 06 Mar 2023 04:20:48 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0C2621803729; Mon, 6 Mar 2023 09:20:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDC9940C10FA; Mon, 6 Mar 2023 09:20:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D0F24194658C; Mon, 6 Mar 2023 09:20:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4A3BD19465A8 for ; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3FB281121314; Mon, 6 Mar 2023 09:20:42 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id B59F1112132D for ; Mon, 6 Mar 2023 09:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678094527; 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=/lgpRTiLnhC3yx4AsJZga+kCzHquhITn8eCpMTpQcsY=; b=c4HbD9i9/ULoFM6x1anI/uMv66Ae/eGsiX/Uuc50Ew/Ben1PJ0pdG6bfdsej1UQl9qKsGk ZJ8TXWaKHEabWSaVbbnoRHRe35/RK/bBaM81IGdaov48Hx+Lm+n9xSiQyyOmmWJTSGbyTJ lfabBMMlVIgyyPw4Bb2BrJA+rntqdwA= X-MC-Unique: 8HmWpA6mPB2b2MJ055VcYA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/6] util: json: Remove unused virJSONValueObjectAppendStringPrintf Date: Mon, 6 Mar 2023 10:20:35 +0100 Message-Id: <66fc48cf7401e422043187fb217d5948ac318f92.1678094352.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: 1678094530001100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/util/virjson.c | 17 ----------------- src/util/virjson.h | 6 ------ 3 files changed, 24 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b249dcc85c..8792bf7f54 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2621,7 +2621,6 @@ virJSONValueObjectAppendNumberLong; virJSONValueObjectAppendNumberUint; virJSONValueObjectAppendNumberUlong; virJSONValueObjectAppendString; -virJSONValueObjectAppendStringPrintf; virJSONValueObjectDeflatten; virJSONValueObjectForeachKeyValue; virJSONValueObjectGet; diff --git a/src/util/virjson.c b/src/util/virjson.c index 1c3a50440e..4e822063bc 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -609,23 +609,6 @@ virJSONValueObjectAppendString(virJSONValue *object, } -int -virJSONValueObjectAppendStringPrintf(virJSONValue *object, - const char *key, - const char *fmt, - ...) -{ - va_list ap; - g_autofree char *str =3D NULL; - - va_start(ap, fmt); - str =3D g_strdup_vprintf(fmt, ap); - va_end(ap); - - return virJSONValueObjectInsertString(object, key, str, false); -} - - int virJSONValueObjectPrependString(virJSONValue *object, const char *key, diff --git a/src/util/virjson.h b/src/util/virjson.h index 0ea7caad23..95b8b14ae6 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -204,12 +204,6 @@ virJSONValueObjectAppendString(virJSONValue *object, const char *key, const char *value); int -virJSONValueObjectAppendStringPrintf(virJSONValue *object, - const char *key, - const char *fmt, - ...) - G_GNUC_PRINTF(3, 4); -int virJSONValueObjectPrependString(virJSONValue *object, const char *key, const char *value); --=20 2.39.2