From nobody Mon Feb 9 09:09:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+69059+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69059+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1608158788; cv=none; d=zohomail.com; s=zohoarc; b=Nzv8muxdY1kgQa0NjHINEqSrkmfaG5G7GwYCdWWGM20+eRsRRd9Mr4k6m5SUEseocFd1cQXhnMd45VHHLLsIRH3jr3WnRiKitc0j4ecFjpnBP5NEBiaVkTCf1Lge1BdwnpFWNWAFnjD99xTBwLxMuV9at+coTEb0c8TB6d/D0As= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608158788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=RK25An1gXQj0oUGc2YcNVkSknje9hBVzmSELWpno7Qc=; b=RsYwT3oD8LFZs3q/Mdj00iZ7WrpxG7t1cbDIgf/uHD9X3EQnyR8UGnUJL52JgqTZddND7t2pDXmHgYq9aq1JVBX9gst1x7WQXiJ5OC9vx6ojedV0aT3G7ByNmbmSmUMatlnXWJpqBUc1VLIxHzEi7GWGa6/psZTNiDrDJNLL4bU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+69059+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1608158788071533.2618647479569; Wed, 16 Dec 2020 14:46:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HVqAYY1788612xfyBaLaXoY0; Wed, 16 Dec 2020 14:46:26 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web09.4993.1608158781209237643 for ; Wed, 16 Dec 2020 14:46:21 -0800 X-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-1-ghPLVSt8Nh28W0J2m9nyuw-1; Wed, 16 Dec 2020 17:46:15 -0500 X-MC-Unique: ghPLVSt8Nh28W0J2m9nyuw-1 X-Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BC1710054FF; Wed, 16 Dec 2020 22:46:14 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-152.ams2.redhat.com [10.36.114.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C62110013C0; Wed, 16 Dec 2020 22:46:09 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io, virtio-fs@redhat.com, lersek@redhat.com Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2-devel] [edk2 PATCH 45/48] OvmfPkg/VirtioFsDxe: add helper for determining file size update Date: Wed, 16 Dec 2020 22:11:22 +0100 Message-Id: <20201216211125.19496-46-lersek@redhat.com> In-Reply-To: <20201216211125.19496-1-lersek@redhat.com> References: <20201216211125.19496-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com X-Gm-Message-State: hZnE3mvtGdKz85OAlnvWOqWCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1608158786; bh=RK25An1gXQj0oUGc2YcNVkSknje9hBVzmSELWpno7Qc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=XT9MQrj9EbkMEIkRMEcqn+ftpjeVydEH4CVRYNu1K3ZsExMv4eGhd5odj41jTICDrxF suZMlyD8quDlzRrA35q8P0MM8lRZjENwB7xLZD5OSlZxwONTSsj0QiI0uYObB3DvbOvBb H77aivDfOWB+8fnlyunZofDggvSnRJ/w6JU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the VirtioFsGetFuseSizeUpdate() function, for determining whether an EFI_FILE_PROTOCOL.SetInfo() invocation requests a file size update. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daud=C3=A9 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3097 Signed-off-by: Laszlo Ersek --- OvmfPkg/VirtioFsDxe/VirtioFsDxe.h | 8 ++++ OvmfPkg/VirtioFsDxe/Helpers.c | 40 ++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h b/OvmfPkg/VirtioFsDxe/Virtio= FsDxe.h index 9e6348f9386e..096756302942 100644 --- a/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h +++ b/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h @@ -277,16 +277,24 @@ VirtioFsFuseAttrToEfiFileInfo ( ); =20 EFI_STATUS VirtioFsFuseDirentPlusToEfiFileInfo ( IN VIRTIO_FS_FUSE_DIRENTPLUS_RESPONSE *FuseDirent, IN OUT EFI_FILE_INFO *FileInfo ); =20 +VOID +VirtioFsGetFuseSizeUpdate ( + IN EFI_FILE_INFO *Info, + IN EFI_FILE_INFO *NewInfo, + OUT BOOLEAN *Update, + OUT UINT64 *Size + ); + // // Wrapper functions for FUSE commands (primitives). // =20 EFI_STATUS VirtioFsFuseLookup ( IN OUT VIRTIO_FS *VirtioFs, IN UINT64 DirNodeId, diff --git a/OvmfPkg/VirtioFsDxe/Helpers.c b/OvmfPkg/VirtioFsDxe/Helpers.c index b741cf753495..838971bd2c85 100644 --- a/OvmfPkg/VirtioFsDxe/Helpers.c +++ b/OvmfPkg/VirtioFsDxe/Helpers.c @@ -2168,8 +2168,48 @@ VirtioFsFuseDirentPlusToEfiFileInfo ( FileInfo->FileName[Idx++] =3D L'\0'; // // Set the (possibly reduced) size. // FileInfo->Size =3D FileInfoSize; =20 return EFI_SUCCESS; } + +/** + Given an EFI_FILE_INFO object received in an EFI_FILE_PROTOCOL.SetInfo() + call, determine whether updating the size of the file is necessary, rela= tive + to an EFI_FILE_INFO object describing the current state of the file. + + @param[in] Info The EFI_FILE_INFO describing the current state of the + file. The caller is responsible for populating Info = on + input with VirtioFsFuseAttrToEfiFileInfo(), from the + current FUSE attributes of the file. The Info->Size = and + Info->FileName members are ignored. + + @param[in] NewInfo The EFI_FILE_INFO object received in the + EFI_FILE_PROTOCOL.SetInfo() call. + + @param[out] Update Set to TRUE on output if the file size needs to be + updated. Set to FALSE otherwise. + + @param[out] Size If Update is set to TRUE, then Size provides the new= file + size to set. Otherwise, Size is not written to. +**/ +VOID +VirtioFsGetFuseSizeUpdate ( + IN EFI_FILE_INFO *Info, + IN EFI_FILE_INFO *NewInfo, + OUT BOOLEAN *Update, + OUT UINT64 *Size + ) +{ + BOOLEAN IsDirectory; + + IsDirectory =3D (BOOLEAN)((Info->Attribute & EFI_FILE_DIRECTORY) !=3D 0); + + if (IsDirectory || Info->FileSize =3D=3D NewInfo->FileSize) { + *Update =3D FALSE; + return; + } + *Update =3D TRUE; + *Size =3D NewInfo->FileSize; +} --=20 2.19.1.3.g30247aa5d201 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69059): https://edk2.groups.io/g/devel/message/69059 Mute This Topic: https://groups.io/mt/79024600/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-