From nobody Wed May 14 10:27:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527460158643504.2116123399255; Sun, 27 May 2018 15:29:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0743C9B0F; Sun, 27 May 2018 22:29:16 +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 9A0379420E; Sun, 27 May 2018 22:29:16 +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 143F74CA89; Sun, 27 May 2018 22:29:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4RMSmfo015013 for ; Sun, 27 May 2018 18:28:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id C569E1001949; Sun, 27 May 2018 22:28:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC8A31001942 for ; Sun, 27 May 2018 22:28:45 +0000 (UTC) Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FEAC19D2AA for ; Sun, 27 May 2018 22:28:34 +0000 (UTC) Received: by mail-wr0-f172.google.com with SMTP id i12-v6so17316579wrc.4 for ; Sun, 27 May 2018 15:28:34 -0700 (PDT) Received: from machado.local ([95.82.135.172]) by smtp.gmail.com with ESMTPSA id h81-v6sm23469897wmd.0.2018.05.27.15.28.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 May 2018 15:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fidencio-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4YjG/3F2OD9z08UX3T04I9w1iMbR2aIThBn/F1Ptpd4=; b=cAcmFfsjGKnwJ+12kjthIEgrrPEVHFbGDuJ2JpUqNru9VhsT3knMo+6pvyhcwqRCK3 DMVF+srpHoO8iipM2D1YnH35FwVj3RTIo2mvojMCemZXGvHIw3pLId/7gQjJhxG+/867 OVEbvey1J0JlYdV8tjXHiQ2TPrpfGoHenH2D4wsNFVAkBnmhwpf62M6sRT+YvqI11kba imus3nzKn7LgBGLRigDYX7JxkCdNFDRgSj+GvVVq76TnUvG3EpyPQpJi6wTDm/IWThb7 YoXSUGDtjqOcqiuqcmN2Z8ykaCbGrKqRqZzMY1fBX6xtdZFLDcgAtLD63dHOYC+2HQB5 D1mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4YjG/3F2OD9z08UX3T04I9w1iMbR2aIThBn/F1Ptpd4=; b=V/rbwRyFgynmqPwQnqp0BLxx6Mif2iy02bSqwqvOaLSPjy8ZGeVk1dm9tTOa15cNQR PzMLqN3NP8nTWii98Utb37YI6lCQ700zMGi6TBzcJqE92Y1rL52QDdXIxO9H85F7GWKC vnzE6NmmQQMO42+600hRmdJk7bKNSASFm99GVBUJWrSABh7Go/Zz90P7H2tj4Z/A0Nma XXaMP+kKanXj0//xpPJJHAcLtzGuSjDevGq+9zrMpddHoQRPqYnkAQwvpaCYZvjjF5eC DsjRzHjYwnT1FOINRDmms/erjQ+rqCrAjfZRtm32ARSfH13a8mzRIBYOGm8PsFB6jfBX 3ASA== X-Gm-Message-State: ALKqPwdiVvoOyLpLkNZSiX8jADO1Ty4RZiJp039J7e5ZF4vspeJ+Nn0M jNP9yWahOcnGR/aP+QEFqwJod2Cs X-Google-Smtp-Source: AB8JxZoV4LIPfp1okzq2fF9hEdnTcxRpfMsQ58ueZEnrsAvKEUfgd0ltLNw5Mr4Fr42x/0VKa6soeA== X-Received: by 2002:adf:cd08:: with SMTP id w8-v6mr9430857wrm.187.1527460112805; Sun, 27 May 2018 15:28:32 -0700 (PDT) From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Mon, 28 May 2018 00:28:21 +0200 Message-Id: <20180527222826.18525-3-fabiano@fidencio.org> In-Reply-To: <20180527222826.18525-1-fabiano@fidencio.org> References: <20180527222826.18525-1-fabiano@fidencio.org> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 27 May 2018 22:28:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 27 May 2018 22:28:34 +0000 (UTC) for IP:'209.85.128.172' DOMAIN:'mail-wr0-f172.google.com' HELO:'mail-wr0-f172.google.com' FROM:'fabiano@fidencio.org' RCPT:'' X-RedHat-Spam-Score: 0.1 (DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID) 209.85.128.172 mail-wr0-f172.google.com 209.85.128.172 mail-wr0-f172.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCHv3 2/7] xen_vm: convert to typesafe virConf accessors 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 27 May 2018 22:29:17 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Fabiano Fid=C3=AAncio Reviewed-by: J=EF=BF=BDn Tomko --- src/xenconfig/xen_xm.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index be50a13909..ef52cf4250 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -263,20 +263,20 @@ xenParseXMDisk(char *entry, int hvm) static int xenParseXMDiskList(virConfPtr conf, virDomainDefPtr def) { + char **disks =3D NULL, **entries; int hvm =3D def->os.type =3D=3D VIR_DOMAIN_OSTYPE_HVM; - virConfValuePtr list =3D virConfGetValue(conf, "disk"); + int ret =3D -1; + int rc; =20 - if (!list || list->type !=3D VIR_CONF_LIST) - return 0; + rc =3D virConfGetValueStringList(conf, "disk", false, &disks); + if (rc <=3D 0) + return rc; =20 - for (list =3D list->list; list; list =3D list->next) { + for (entries =3D disks; *entries; entries++) { virDomainDiskDefPtr disk; - int rc; + char *entry =3D *entries; =20 - if ((list->type !=3D VIR_CONF_STRING) || (list->str =3D=3D NULL)) - continue; - - if (!(disk =3D xenParseXMDisk(list->str, hvm))) + if (!(disk =3D xenParseXMDisk(entry, hvm))) continue; =20 /* Maintain list in sorted order according to target device name */ @@ -284,10 +284,14 @@ xenParseXMDiskList(virConfPtr conf, virDomainDefPtr d= ef) virDomainDiskDefFree(disk); =20 if (rc < 0) - return -1; + goto cleanup; } =20 - return 0; + ret =3D 0; + + cleanup: + virStringListFree(disks); + return ret; } =20 =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list