From nobody Mon Feb 9 14:33:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591752431; cv=none; d=zohomail.com; s=zohoarc; b=gI/dHjxdt6VUChTJ/LRnsKv5TFtTVYKb+tAQnO9O1yPJyz4BGI75MueOtJKt0474e+nCbtp/Y+pfH2R9+CajrZssGij07xzUHwU4t3A31f0MAqvReCyJJJVJFE194zeQ74eWLy7y7tLA+xu6Cf9fbtFtha4iAe/k7wB0xN4kc0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591752431; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=SrIcnpp/w+DHaoay9HDWACvDwM+GzamWuJI7Isd9jZA=; b=MKEpl2heEN5zsDvdJpzcI9zmk9WUlT2R1auIiIGRJgrv8RrUUBSoWme4Dqw5MliqVeQvbczw0J6jeIeXFkcQvHymBWxzw+eWPYOk4dYP8C7Dz/RHEE5VBmZXHMzmOpormL0v5cFDqQLAxwLvmVzDlMiF4aNk8zgywuSLAzSWC00= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1591752431841866.1575306850083; Tue, 9 Jun 2020 18:27:11 -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-493-k7LbjrOQM6mCXyHEGrXbgA-1; Tue, 09 Jun 2020 21:27:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6833B1005510; Wed, 10 Jun 2020 01:27:01 +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 459E710190A7; Wed, 10 Jun 2020 01:27:01 +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 12DDAB34B3; Wed, 10 Jun 2020 01:27:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05A1QvCR027365 for ; Tue, 9 Jun 2020 21:26:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0563C2026E1C; Wed, 10 Jun 2020 01:26:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F34732026D5D for ; Wed, 10 Jun 2020 01:26:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EC1780CDB3 for ; Wed, 10 Jun 2020 01:26:54 +0000 (UTC) Received: from mail-m24147.qiye.163.com (mail-m24147.qiye.163.com [220.194.24.147]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-ghmUwR4iONW2cxgc2jcxGQ-1; Tue, 09 Jun 2020 21:26:51 -0400 Received: from localhost.localdomain (unknown [58.56.27.130]) by smtp4 (Coremail) with SMTP id JedpCgCnxdh_NeBeVKS4Bw--.7295S13; Wed, 10 Jun 2020 09:21:35 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591752430; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SrIcnpp/w+DHaoay9HDWACvDwM+GzamWuJI7Isd9jZA=; b=UaRM45ORlFhIbTKkbqKTheE3JzGHoGAe85uEIHRUBSL6S+D/VS2kPGUNprSLNWCQjqO04k JvBFMywwhfyXNfOb2T4B018MtbcLd7sHwQ7AFyNyAD7VPOYslIE1p8pYttYm6izGoWhOTo uEKijP2/lqE9A9zhfKBsryOGO2TeaWo= X-MC-Unique: k7LbjrOQM6mCXyHEGrXbgA-1 X-MC-Unique: ghmUwR4iONW2cxgc2jcxGQ-1 From: Shi Lei To: libvir-list@redhat.com Subject: [RFC 11/21] conf: Generate virNetworkDNSSrvDefFormatBuf Date: Wed, 10 Jun 2020 09:20:39 +0800 Message-Id: <20200610012049.10774-12-shi_lei@massclouds.com> In-Reply-To: <20200610012049.10774-1-shi_lei@massclouds.com> References: <20200610012049.10774-1-shi_lei@massclouds.com> X-CM-TRANSID: JedpCgCnxdh_NeBeVKS4Bw--.7295S13 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjTRpE_MDUUUU X-Originating-IP: [58.56.27.130] X-CM-SenderInfo: pvklsz1hl6ztxvvfz0xxgvhudrp/1tbicQA-T1lZvNe9ugAAst X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.84 on 10.5.11.22 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- src/conf/network_conf.c | 18 ++---------------- src/conf/network_conf.h | 4 ++-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index bfdc10b..e8e7922 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2275,22 +2275,8 @@ virNetworkDNSDefFormat(virBufferPtr buf, =20 for (i =3D 0; i < def->nsrvs; i++) { if (def->srvs[i].service && def->srvs[i].protocol) { - virBufferEscapeString(buf, "srvs[i].service); - virBufferEscapeString(buf, "protocol=3D'%s'", def->srvs[i].pro= tocol); - - if (def->srvs[i].domain) - virBufferEscapeString(buf, " domain=3D'%s'", def->srvs[i].= domain); - if (def->srvs[i].target) - virBufferEscapeString(buf, " target=3D'%s'", def->srvs[i].= target); - if (def->srvs[i].port) - virBufferAsprintf(buf, " port=3D'%d'", def->srvs[i].port); - if (def->srvs[i].priority) - virBufferAsprintf(buf, " priority=3D'%d'", def->srvs[i].pr= iority); - if (def->srvs[i].weight) - virBufferAsprintf(buf, " weight=3D'%d'", def->srvs[i].weig= ht); - - virBufferAddLit(buf, "/>\n"); + if (virNetworkDNSSrvDefFormatBuf(buf, "srv", &def->srvs[i], NU= LL) < 0) + return -1; } } =20 diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 3a4d829..c867f27 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -137,10 +137,10 @@ struct _virNetworkDNSTxtDef { /* genparse:conciseho= ok, genformat */ =20 typedef struct _virNetworkDNSSrvDef virNetworkDNSSrvDef; typedef virNetworkDNSSrvDef *virNetworkDNSSrvDefPtr; -struct _virNetworkDNSSrvDef { /* genparse:withhook */ - char *domain; /* xmlattr */ +struct _virNetworkDNSSrvDef { /* genparse:withhook, genformat */ char *service; /* xmlattr */ char *protocol; /* xmlattr */ + char *domain; /* xmlattr */ char *target; /* xmlattr */ unsigned int port; /* xmlattr */ unsigned int priority; /* xmlattr */ --=20 2.17.1