From nobody Sun Feb 8 13:53:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1628263490; cv=none; d=zohomail.com; s=zohoarc; b=Ml1NdLGLLeB0aHPLeyi+Jz0CRW8MGb8/zMk1L+Uxq/wd2QA2cRYy5SOQ2Zn70cWNOL13TgFdKRHFZeVnjeobsY6k9pAJeLPhPUoLi4o5Yo4N23EwJyNbXJ9GTsV+pYzTt2qohY36VcF9b7dvlaPFCC54covQVN2IqlAW2USkhRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628263490; 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=w/KStEvmePiDU3PecZMKEWfd9oQs1/PhTiltCa0ctng=; b=LdbfR9yyhIcVh+eRaAQuEjX/EMEkXjelP6sCVkSS73WSWQ+/wxAqTYR2PnwihsbOuDHzwQ/H+ZbplkNsON7Pm+WGh0ONBRAwK/FOAF1lcehMxOSnipBOZDrCigA4lAkfxwRSJrznuFDk8rhGX9iYhsVom/Tq1APR2yXC9RiUW6g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1628263490948116.40375597421189; Fri, 6 Aug 2021 08:24:50 -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-320-z6glSQ1JMH6_tSCYH0cfBA-1; Fri, 06 Aug 2021 11:24:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62984107ACF5; Fri, 6 Aug 2021 15:24:43 +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 481761981C; Fri, 6 Aug 2021 15:24:43 +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 1307F180BAB3; Fri, 6 Aug 2021 15:24:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 176FMj3W017526 for ; Fri, 6 Aug 2021 11:22:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id B4B641346F; Fri, 6 Aug 2021 15:22:45 +0000 (UTC) Received: from bart.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3ECD219CBA for ; Fri, 6 Aug 2021 15:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628263489; 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=w/KStEvmePiDU3PecZMKEWfd9oQs1/PhTiltCa0ctng=; b=KRN9HbXuKLxuWKcN6HjXSRGtAmtPik/N5nGlsdgz/7/M6yA0WRhrRTXeRMf5qcdUKpry5M iwQY0vn7wq+abqRS2qXsiTP0hqVK24i1nkDoQT63nz8+o1nR3YomAl5UFzDbtE12KeIBv1 bFwS2gDbBrcAxXcNOwcsR5eVohn6XX0= X-MC-Unique: z6glSQ1JMH6_tSCYH0cfBA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/4] qemuDomainOpenFile: Take virDomainDef instead of virDomainObj Date: Fri, 6 Aug 2021 17:22:36 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.79 on 10.5.11.11 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: 1628263491718100001 Content-Type: text/plain; charset="utf-8" The function doesn't really need domain object, but domain definition from which it takes seclabels. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 8 ++++---- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_saveimage.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6f8c93ea0c..5a88e82856 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11503,7 +11503,7 @@ virQEMUFileOpenAs(uid_t fallback_uid, /** * qemuDomainOpenFile: * @driver: driver object - * @vm: domain object + * @def: domain definition * @path: path to file to open * @oflags: flags for opening/creation of the file * @needUnlink: set to true if file was created by this function @@ -11518,7 +11518,7 @@ virQEMUFileOpenAs(uid_t fallback_uid, **/ int qemuDomainOpenFile(virQEMUDriver *driver, - virDomainObj *vm, + const virDomainDef *def, const char *path, int oflags, bool *needUnlink) @@ -11530,8 +11530,8 @@ qemuDomainOpenFile(virQEMUDriver *driver, virSecurityLabelDef *seclabel; =20 /* TODO: Take imagelabel into account? */ - if (vm && - (seclabel =3D virDomainDefGetSecurityLabelDef(vm->def, "dac")) != =3D NULL && + if (def && + (seclabel =3D virDomainDefGetSecurityLabelDef(def, "dac")) !=3D NU= LL && seclabel->label !=3D NULL && (virParseOwnershipIds(seclabel->label, &user, &group) < 0)) return -EINVAL; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index acf6ca5ab6..63f657fa49 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1046,7 +1046,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid, =20 int qemuDomainOpenFile(virQEMUDriver *driver, - virDomainObj *vm, + const virDomainDef *def, const char *path, int oflags, bool *needUnlink); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7d76dd00f..d432c69dae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10820,7 +10820,7 @@ qemuDomainStorageOpenStat(virQEMUDriver *driver, if (skipInaccessible && !virFileExists(src->path)) return 0; =20 - if ((*ret_fd =3D qemuDomainOpenFile(driver, vm, src->path, O_RDONL= Y, + if ((*ret_fd =3D qemuDomainOpenFile(driver, vm->def, src->path, O_= RDONLY, NULL)) < 0) return -1; =20 diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index b4af80f942..f93454c761 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -313,7 +313,7 @@ qemuSaveImageCreate(virQEMUDriver *driver, if (qemuDomainFileWrapperFDClose(vm, wrapperFd) < 0) goto cleanup; =20 - if ((fd =3D qemuDomainOpenFile(driver, vm, path, O_WRONLY, NULL)) < 0 = || + if ((fd =3D qemuDomainOpenFile(driver, vm->def, path, O_WRONLY, NULL))= < 0 || virQEMUSaveDataFinish(data, &fd, path) < 0) goto cleanup; =20 --=20 2.31.1