From nobody Mon Feb 9 19:05:21 2026 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=1650641542; cv=none; d=zohomail.com; s=zohoarc; b=UjUkDhHRpkUwEJL072hE9j4FnDmMOQlZBpXH0poRAnXY3sA+X4Nuli83w/xFVRijhBoP1qrV+8cHuaPZmuH8srq+ZffAZSMDR+7dZg/BF8dbph5Iyw2Mgb6o9jlmSnWXZhyMjxjbe5YVwI/CVExBKbnIiXQEZo5k3zb/adWJXcY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650641542; 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=aQ7J8CRIHDqCF/i3H3oB2XUGheqpNxAxSprTCDG7Tkg=; b=EuPu2Yij/+W6lTjc6IJbRGmiaYc/n7pIBh/DBZuSmaxMKghaVvp1HWCrjVkMDSwohXn30cxscM/3CCIC/D/3Tdy/d31w9n4lrYNgHEYo5jySNfDPhkkim6Vz1xU8kAKPGj7qH+aftXEsEwPynGhcbgykuIiyE4atjLuULVpKNjo= 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 165064154228487.70753663159326; Fri, 22 Apr 2022 08:32:22 -0700 (PDT) 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-481-Fd5VWlp0O4SIkVgk-cCInw-1; Fri, 22 Apr 2022 11:32:14 -0400 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 C0EB3833975; Fri, 22 Apr 2022 15:32:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A893940EC024; Fri, 22 Apr 2022 15:32:05 +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 5E1F51940367; Fri, 22 Apr 2022 15:32:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8BCDD194036F for ; Fri, 22 Apr 2022 15:32:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5812241636C; Fri, 22 Apr 2022 15:32:03 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB4BF401475 for ; Fri, 22 Apr 2022 15:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650641541; 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=aQ7J8CRIHDqCF/i3H3oB2XUGheqpNxAxSprTCDG7Tkg=; b=IbCMnicqRYsB0tFKpmhl3TaBgSoDOCJI5mrQeAF31FsxZOcnlJRrGnbchDsBsu8A7bWnuk sDqouR92StBCyYhSACgBBuX3OmGJvWiisa4+76MH4I5Uw225TfgFF/zsjKR5taRGH/9IxL 6x9YtGvtooPHlEtaIPMCvRVrz36SAl8= X-MC-Unique: Fd5VWlp0O4SIkVgk-cCInw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/11] qemu: domain: Inline qemuDomainDiskHasEncryptionSecret Date: Fri, 22 Apr 2022 17:31:51 +0200 Message-Id: <47da8409e1dde0ef0f022e30832bc0f89f6036ea.1650641396.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1650641597492100009 Content-Type: text/plain; charset="utf-8" Since we are already checking that the encryption format can be only _LUKS and _LUKS2 this wrapper function doesn't make much sense any more. The only one caller can do this internally. The move of virStorageSourceIsEmpty is correct as there are no secrets to setup if the disk is empty anyways. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0486826fc7..1eb15c8989 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1243,19 +1243,6 @@ qemuDomainStorageSourceHasAuth(virStorageSource *src) } -static bool -qemuDomainDiskHasEncryptionSecret(virStorageSource *src) -{ - if (!virStorageSourceIsEmpty(src) && src->encryption && - (src->encryption->format =3D=3D VIR_STORAGE_ENCRYPTION_FORMAT_LUKS= || - src->encryption->format =3D=3D VIR_STORAGE_ENCRYPTION_FORMAT_LUKS= 2) && - src->encryption->nsecrets > 0) - return true; - - return false; -} - - static qemuDomainSecretInfo * qemuDomainSecretStorageSourcePrepareCookies(qemuDomainObjPrivate *priv, virStorageSource *src, @@ -1291,7 +1278,10 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPr= ivate *priv, { qemuDomainStorageSourcePrivate *srcPriv; bool hasAuth =3D qemuDomainStorageSourceHasAuth(src); - bool hasEnc =3D qemuDomainDiskHasEncryptionSecret(src); + bool hasEnc =3D src->encryption && src->encryption->nsecrets > 0; + + if (virStorageSourceIsEmpty(src)) + return 0; if (!hasAuth && !hasEnc && src->ncookies =3D=3D 0) return 0; --=20 2.35.1