From nobody Mon Feb 9 03:46:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1595411072; cv=none; d=zohomail.com; s=zohoarc; b=Q9nCSoMtYdikOPKZBdj/9K2+JeCp6EW1sf7aHGOACOvXUJowEd6F+jBREapII5EDiCYKOHwM1z9JH4ESKoUYqIYZh60eNRghTOryLPfIJx72o95h5+qcO/cBI3D9IIcIDSPEJ4ehX1T3FxaXxbvhISFGqFkt6CWUzbu1rvcD6FU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595411072; 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=uFad8el2oMtj5ZJ3JZeL9qV92IRFAVPHrONoLZjttoc=; b=mEi5WOxSIoD7qnUOrKtKlW+5/bjYKJwrbT1uBc0PVhfYuv84slN4nmh8uJIAAMHK9KMfd47/+01Qu6/5IRI1jMKL3iwQCS7Gn1ro2KwPj+tILMtAnYxFvrtsLaeZBmW5v6fwgBCpRtsg/JOlrqWIYT4OiXw2xhKceNK0k/7HC+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1595411072218482.74756377537346; Wed, 22 Jul 2020 02:44:32 -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-325-wUIgb26WPcO7AhpZD3kflw-1; Wed, 22 Jul 2020 05:44:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1A58100CCD1; Wed, 22 Jul 2020 09:44:21 +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 82BBF2DE7F; Wed, 22 Jul 2020 09:44:21 +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 44AA01806B0D; Wed, 22 Jul 2020 09:44:21 +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 06M9fHDs001173 for ; Wed, 22 Jul 2020 05:41:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6BB8D2DE81; Wed, 22 Jul 2020 09:41:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEFBB2DE80 for ; Wed, 22 Jul 2020 09:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595411071; 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=uFad8el2oMtj5ZJ3JZeL9qV92IRFAVPHrONoLZjttoc=; b=XdoLfa3+XkN2ZsmfERyEMRtQUyOBl9V4cxAbOa46prUDC2EvwaQQUIBFk0QL0N/0P0m0TG nUUaAJhMrvVZPhoXrolqpUdcV1no08mdbh77Cz0DD79/CUB+ei6ARQTHZbLPlbuHLz+a12 DvHlfTKxN+XI0ZsQPy+6sJVcBM2Yyjs= X-MC-Unique: wUIgb26WPcO7AhpZD3kflw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 33/34] qemuDomainNamespaceTeardownRNG: Deduplicate code Date: Wed, 22 Jul 2020 11:40:27 +0200 Message-Id: <9a4ea8c8d613d87abcaac5336adf0b61883635f5.1595410402.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We can use qemuDomainSetupRNG() to obtain the path that we need to unlink() from within domain's namespace. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_namespace.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namesp= ace.c index 7a329c0c4a..89d73b26ef 100644 --- a/src/qemu/qemu_domain_namespace.c +++ b/src/qemu/qemu_domain_namespace.c @@ -1568,23 +1568,15 @@ int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm, virDomainRNGDefPtr rng) { - const char *path =3D NULL; + VIR_AUTOSTRINGLIST paths =3D NULL; =20 if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; =20 - switch ((virDomainRNGBackend) rng->backend) { - case VIR_DOMAIN_RNG_BACKEND_RANDOM: - path =3D rng->source.file; - break; + if (qemuDomainSetupRNG(rng, &paths) < 0) + return -1; =20 - case VIR_DOMAIN_RNG_BACKEND_EGD: - case VIR_DOMAIN_RNG_BACKEND_BUILTIN: - case VIR_DOMAIN_RNG_BACKEND_LAST: - break; - } - - if (path && qemuDomainNamespaceUnlinkPath(vm, path) < 0) + if (qemuDomainNamespaceUnlinkPaths(vm, (const char **) paths) < 0) return -1; =20 return 0; --=20 2.26.2