From nobody Sat Feb 7 07:22:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1727092308810822.2401740509769; Mon, 23 Sep 2024 04:51:48 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2D37912F2; Mon, 23 Sep 2024 07:51:45 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 22AC61655; Mon, 23 Sep 2024 07:48:25 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 34F9913F7; Mon, 23 Sep 2024 07:48:07 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BCCAC13F1 for ; Mon, 23 Sep 2024 07:48:06 -0400 (EDT) Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-QYEbFLVzOtWPaGrLeyiK8g-1; Mon, 23 Sep 2024 07:48:05 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-53661a13121so3802379e87.0 for ; Mon, 23 Sep 2024 04:48:04 -0700 (PDT) Received: from wheatley.localdomain (37-188-137-5.red.o2.cz. [37.188.137.5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9061331bc8sm1204523966b.221.2024.09.23.04.48.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2024 04:48:02 -0700 (PDT) Received: from wheatley.pinto-pinecone.ts.net (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id C7CFB26732F0 for ; Mon, 23 Sep 2024 13:48:00 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727092086; h=from:from: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; bh=2WbnhvYAyxoqFJ5vWLNp1q4CLitx1uzcqhDs64OlmH4=; b=cSbpwBVHwQOT46L/QQyRzigMnvEP9bOgjUKViItC/n6LBrEmJo3uySdz8j37Z5Rff+nPIN unYt2kHUWN601MCp+r1bi5GoMBZweVnZ5IksJcIQajOd2IOiNpPwemVXLsRKSxSEeaske8 mjzIaLX+SM2RvvSp1I/BAb3GhTUEqkU= X-MC-Unique: QYEbFLVzOtWPaGrLeyiK8g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727092084; x=1727696884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2WbnhvYAyxoqFJ5vWLNp1q4CLitx1uzcqhDs64OlmH4=; b=pwR8is3J6RQd2u391brPe5I5+dEAIkAZneJpSrhR1ZrXm0sAFryPMRg27PJTaTscpA /JXhPc/AmkoWT/79Q4S2lhG4AhZGBnShDVJE8AMn6NbRHN3AflmNUApfNA35Gb7YmEQl FlSnDB5SvcDykyEOsPj/EiO+1Mju95iUVUlIW0pQX162SFp700BIoCfEEBLbGKzsEo8v VIuZdBgW9QU9m01BVF4VGAt3ofzP5WfL3rwzSdSEa9dwB0VmTlAgVYc56rFsnx5/Qema 87WRUGRwtHP7FPRASUXO/BctXJh/svxK/rXR5amNTL3TAfSaVrPuiSNJw9dR7qLO+YuM pRjA== X-Gm-Message-State: AOJu0YyMwcJyEyA3t7nAP/0qPQQiwAExndpUyi4yxVLNnKy2sCxUlVEA SfmmwaakQcYQp0dTdqVqp9b6i57QF1vR+2UrrkGkou6BMJ0BjE4mMvLSAeKc97rKSvxhSwuEAzJ PXbt+oVqx+lrv9iwOrYAgjzGq66ZzOjhp3Db4VsgOtdbjv2jri5w51hSAwCjmDA/l+NxYsdRW/H Jum7lVHLb+iOVqt93nIoLFtOmBi3Pn9jMBnlzjc6E= X-Received: by 2002:a05:6512:1293:b0:535:82eb:21d1 with SMTP id 2adb3069b0e04-536ac34094fmr4780344e87.57.1727092083579; Mon, 23 Sep 2024 04:48:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKme685rBCfN7ItToJtcYaOoC7IvI4rzLE5AB/b1eyv4bzT05YMTDejeLiyH2Gk1pFLTsx1A== X-Received: by 2002:a05:6512:1293:b0:535:82eb:21d1 with SMTP id 2adb3069b0e04-536ac34094fmr4780331e87.57.1727092083099; Mon, 23 Sep 2024 04:48:03 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH v2 8/8] qemu: Generate domain memory backing path directly Date: Mon, 23 Sep 2024 13:47:58 +0200 Message-ID: X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: VBIZHXDRCEMDP4YNISL6YTZHQ6HE3YVP X-Message-ID-Hash: VBIZHXDRCEMDP4YNISL6YTZHQ6HE3YVP X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1727092310990116600 Content-Type: text/plain; charset="utf-8"; x-default="true" This makes qemuDomainGenerateMemoryBackingPath() nicer to call. Signed-off-by: Martin Kletzander --- src/qemu/qemu_domain.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 49318f518788..bbdbfd4c0e6e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1737,22 +1737,28 @@ qemuDomainSecretPrepare(virQEMUDriver *driver, =20 static int qemuDomainGenerateMemoryBackingPath(qemuDomainObjPrivate *priv, - const virDomainDef *def, - char **path) + const virDomainDef *def) { virQEMUDriver *driver =3D priv->driver; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); const char *root =3D driver->embeddedRoot; g_autofree char *shortName =3D NULL; =20 + if (priv->memoryBackingDir) + return 0; + if (!(shortName =3D virDomainDefGetShortName(def))) return -1; =20 if (root && !STRPREFIX(cfg->memoryBackingDir, root)) { g_autofree char * hash =3D virDomainDriverGenerateRootHash("qemu",= root); - *path =3D g_strdup_printf("%s/%s-%s", cfg->memoryBackingDir, hash,= shortName); + priv->memoryBackingDir =3D g_strdup_printf("%s/%s-%s", + cfg->memoryBackingDir, + hash, shortName); } else { - *path =3D g_strdup_printf("%s/%s", cfg->memoryBackingDir, shortNam= e); + priv->memoryBackingDir =3D g_strdup_printf("%s/%s", + cfg->memoryBackingDir, + shortName); } =20 return 0; @@ -1803,12 +1809,7 @@ qemuDomainSetPrivatePathsOld(virQEMUDriver *driver, priv->channelTargetDir =3D g_strdup_printf("%s/domain-%s", cfg->channelTargetDir, vm= ->def->name); =20 - if (!priv->memoryBackingDir && - qemuDomainGenerateMemoryBackingPath(priv, vm->def, - &priv->memoryBackingDir) < 0) - return -1; - - return 0; + return qemuDomainGenerateMemoryBackingPath(priv, vm->def); } =20 =20 @@ -1830,12 +1831,7 @@ qemuDomainSetPrivatePaths(virQEMUDriver *driver, priv->channelTargetDir =3D g_strdup_printf("%s/%s", cfg->channelTargetDir, do= mname); =20 - if (!priv->memoryBackingDir && - qemuDomainGenerateMemoryBackingPath(priv, vm->def, - &priv->memoryBackingDir) < 0) - return -1; - - return 0; + return qemuDomainGenerateMemoryBackingPath(priv, vm->def); } =20 =20 --=20 2.46.1