From nobody Sun Feb 8 18:43: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=1628263494; cv=none; d=zohomail.com; s=zohoarc; b=I7abDeV/eBE1s3MvyPRSbbzlAZaXIbMq8YCsRfnQo2WIg7fdnkBFcldTWfcNsHSMFRtica7+Z6ftZnEp6Ev1Z5L6Ij8YqvAQkWPEXkJTTBT7O9Fe9gp6pnY+aoUYCsRmhCpdxhyM39VdCmkYA7Aqy9ThGZAYKdEWYHZSOIShiIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628263494; 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=q/x4vy0EfeiX9de46WdJKnsIB6Qsy7dir4jh2IX/bEc=; b=awXZIzCm7aNiHKYKWRu2pcWiPjWY3Z33/rtto5D0sWwh2F1XA0xn5XKx96I3s+Uk9AzkrcrDRbCYesojRao6negJwzQCEgCUAB3+ydYFdH95Y4RpkvjJC6IqMfQXWoaa7eM3qdBe45A7LYDvZMH4Uyv2T/QRTSxIatGrbG5k7PU= 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 1628263494323471.4611809005454; Fri, 6 Aug 2021 08:24:54 -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-278-kN_dVGOyMnWd9mGyPbYXPg-1; Fri, 06 Aug 2021 11:24:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FA25185302C; Fri, 6 Aug 2021 15:24:46 +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 6A49F69321; Fri, 6 Aug 2021 15:24:46 +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 38C794A7CB; Fri, 6 Aug 2021 15:24:46 +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 176FMkp6017539 for ; Fri, 6 Aug 2021 11:22:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 844D519C87; Fri, 6 Aug 2021 15:22:46 +0000 (UTC) Received: from bart.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E3BC1346F 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=1628263493; 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=q/x4vy0EfeiX9de46WdJKnsIB6Qsy7dir4jh2IX/bEc=; b=MGw/U0Z4J17XWDyphJ2o82OaeMq5To/ViqN5PUO0Ryp1SfbIQuzYMfXxkXyH46US5KqHLT q3OvXMIFfbXHk7ySWdiJMCIee6aBCB9fVCvCB4eZxaeFGXYh05Ivgml29bGB7M48Cat6Bk a2YnpZjcjr2G0AsbXMDojr6lXwF0vC4= X-MC-Unique: kN_dVGOyMnWd9mGyPbYXPg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] qemuDomainOpenFile: Take @cfg instead of driver Date: Fri, 6 Aug 2021 17:22:37 +0200 Message-Id: <440bad6b9d12daa9037d0aad9ea0165efd8639f7.1628263276.git.mprivozn@redhat.com> 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.15 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: 1628263496231100001 Content-Type: text/plain; charset="utf-8" Again, we don't need full driver, just its config. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 5 ++--- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_saveimage.c | 5 +++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5a88e82856..2aa346744d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11502,7 +11502,7 @@ virQEMUFileOpenAs(uid_t fallback_uid, =20 /** * qemuDomainOpenFile: - * @driver: driver object + * @cfg: driver config object * @def: domain definition * @path: path to file to open * @oflags: flags for opening/creation of the file @@ -11517,13 +11517,12 @@ virQEMUFileOpenAs(uid_t fallback_uid, * qemuDomainStorageFileInit and storage driver APIs if possible. **/ int -qemuDomainOpenFile(virQEMUDriver *driver, +qemuDomainOpenFile(virQEMUDriverConfig *cfg, const virDomainDef *def, const char *path, int oflags, bool *needUnlink) { - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); uid_t user =3D cfg->user; gid_t group =3D cfg->group; bool dynamicOwnership =3D cfg->dynamicOwnership; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 63f657fa49..d470dc3822 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1045,7 +1045,7 @@ int virQEMUFileOpenAs(uid_t fallback_uid, bool *needUnlink); =20 int -qemuDomainOpenFile(virQEMUDriver *driver, +qemuDomainOpenFile(virQEMUDriverConfig *cfg, const virDomainDef *def, const char *path, int oflags, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d432c69dae..ed3af5a619 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10808,7 +10808,7 @@ qemuDomainMemoryPeek(virDomainPtr dom, * reported) or -1 otherwise (errors are reported). */ static int -qemuDomainStorageOpenStat(virQEMUDriver *driver, +qemuDomainStorageOpenStat(virQEMUDriver *driver G_GNUC_UNUSED, virQEMUDriverConfig *cfg, virDomainObj *vm, virStorageSource *src, @@ -10820,7 +10820,7 @@ qemuDomainStorageOpenStat(virQEMUDriver *driver, if (skipInaccessible && !virFileExists(src->path)) return 0; =20 - if ((*ret_fd =3D qemuDomainOpenFile(driver, vm->def, src->path, O_= RDONLY, + if ((*ret_fd =3D qemuDomainOpenFile(cfg, vm->def, src->path, O_RDO= NLY, NULL)) < 0) return -1; =20 diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index f93454c761..e14e2987f1 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->def, path, O_WRONLY, NULL))= < 0 || + if ((fd =3D qemuDomainOpenFile(cfg, vm->def, path, O_WRONLY, NULL)) < = 0 || virQEMUSaveDataFinish(data, &fd, path) < 0) goto cleanup; =20 @@ -440,6 +440,7 @@ qemuSaveImageOpen(virQEMUDriver *driver, bool open_write, bool unlink_corrupt) { + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); VIR_AUTOCLOSE fd =3D -1; int ret =3D -1; g_autoptr(virQEMUSaveData) data =3D NULL; @@ -459,7 +460,7 @@ qemuSaveImageOpen(virQEMUDriver *driver, oflags |=3D directFlag; } =20 - if ((fd =3D qemuDomainOpenFile(driver, NULL, path, oflags, NULL)) < 0) + if ((fd =3D qemuDomainOpenFile(cfg, NULL, path, oflags, NULL)) < 0) return -1; =20 if (bypass_cache && --=20 2.31.1