From mboxrd@z Thu Jan 1 00:00:00 1970 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.web12.4796.1608157645451111499 for ; Wed, 16 Dec 2020 14:27:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PpQvf9CJ; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608157644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6RLAIpAJ6BdRXkk/3KGt6puQnulTWYmUn14ROjDTsKw=; b=PpQvf9CJl9N0EtRkPRZr8lGPYAwRHbytPDZoeartDsQARS9thgExNR8Sbk+zFiPrJrIEYr UZ6359DOsTEiVP2EnuUe12DGv12lM+4YjGOPENSnP7A6jvSCPBA3MczUfu+aDK3+44s+KA /n3TynEvvlZiR/vERoY44NoAn/0Rb98= 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-391-3cwK6gj8Pn6GMxIjzNij9Q-1; Wed, 16 Dec 2020 17:27:22 -0500 X-MC-Unique: 3cwK6gj8Pn6GMxIjzNij9Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A7343801817; Wed, 16 Dec 2020 22:27:21 +0000 (UTC) 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 D23AE60CC4; Wed, 16 Dec 2020 22:27:16 +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 PATCH 36/48] OvmfPkg/VirtioFsDxe: implement EFI_FILE_PROTOCOL.Read() for directories Date: Wed, 16 Dec 2020 22:11:13 +0100 Message-Id: <20201216211125.19496-37-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.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 VXNpbmcgdGhlIGZ1bmN0aW9ucyBpbnRyb2R1Y2VkIHByZXZpb3VzbHksIHdlIGNhbiBub3cgaW1w bGVtZW50ClZpcnRpb0ZzU2ltcGxlRmlsZVJlYWQoKSBmb3IgZGlyZWN0b3JpZXMgYXMgd2VsbC4K ClRoaXMgcGF0Y2ggY29tcGxldGVzIHRoZSByZWFkLW9ubHkgc3VwcG9ydCBmb3IgdmlydGlvLWZz LiBDb21tYW5kcyBsaWtlCiJUWVBFIiBhbmQgIkRJUiIgd29yayBpbiB0aGUgVUVGSSBzaGVsbC4K CkNjOiBBcmQgQmllc2hldXZlbCA8YXJkLmJpZXNoZXV2ZWxAYXJtLmNvbT4KQ2M6IEpvcmRhbiBK dXN0ZW4gPGpvcmRhbi5sLmp1c3RlbkBpbnRlbC5jb20+CkNjOiBQaGlsaXBwZSBNYXRoaWV1LURh dWTDqSA8cGhpbG1kQHJlZGhhdC5jb20+ClJlZjogaHR0cHM6Ly9idWd6aWxsYS50aWFub2NvcmUu b3JnL3Nob3dfYnVnLmNnaT9pZD0zMDk3ClNpZ25lZC1vZmYtY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SVJUSU9fRlNfRlVTRV9ESVJFTlRQTFVTX1JF U1BPTlNFLg0KKw0KKyAgQHBhcmFtW2luXSBEaXJlbnQgICAgICAgICAgICAgIFRoZSBlbnRyeSBy ZWFkIGZyb20gdGhlIGRpcmVjdG9yeSBzdHJlYW0uIFRoZQ0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIGNhbGxlciBpcyByZXNwb25zaWJsZSBmb3IgZW5zdXJpbmcgdGhhdA0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIERpcmVudC0+TmFtZWxlbiBkZXNjcmliZSB2 YWxpZCBzdG9yYWdlLg0KKw0KKyAgQHBhcmFtW2luXSBTaW5nbGVGaWxlSW5mb1NpemUgIFRoZSBh bGxvY2F0ZWQgc2l6ZSBvZiBGaWxlSW5mby4NCisNCisgIEBwYXJhbVtvdXRdIEZpbGVJbmZvICAg ICAgICAgICBUaGUgRUZJX0ZJTEVfSU5GTyBvYmplY3QgdG8gcG9wdWxhdGUuIE9uDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VjY2VzcywgYWxsIGZpZWxkcyBpbiBGaWxlSW5m byB3aWxsIGJlDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdXBkYXRlZCwgc2V0 dGluZyBGaWxlSW5mby0+U2l6ZSB0byB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBhY3R1YWxseSB1c2VkIHNpemUgKHdoaWNoIHdpbGwgbm90IGV4Y2VlZA0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIFNpbmdsZUZpbGVJbmZvU2l6ZSkuDQorDQorICBAcmV0 dmFsIEVGSV9TVUNDRVNTICBGaWxlSW5mbyBoYXMgYmVlbiBmaWxsZWQgaW4uDQorDQorICBAcmV0 dXJuICAgICAgICAgICAgICBFcnJvciBjb2RlcyBwcm9wYWdhdGVkIGZyb20NCisgICAgICAgICAg ICAgICAgICAgICAgIFZpcnR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X0lORk8g Y2FjaGUgZnJvbSB0aGUgZGlyZWN0b3J5IHN0cmVhbS4NCisqKi8NCitTVEFUSUMNCitFRklfU1RB VFVTDQorUmVmaWxsRmlsZUluZm9DYWNoZSAoDQorICBJTiBPVVQgVklSVElPX0ZTX0ZJTEUgKlZp cnRpb0ZzRmlsZQ0KKyAgKQ0KK3sNCisgIFZJUlRJT19GUyAgICAgICAgICAgICAgICAgICAgICAq VmlydGlvRnM7DQorICBFRklfU1RBVFVTICAgICAgICAgICAgICAgICAgICAgU3RhdHVzOw0KKyAg VklSVElPX0ZTX0ZVU0VfU1RBVEZTX1JFU1BPTlNFIEZpbGVzeXNBdHRyOw0KKyAgVUlOVDMyICAg ICAgICAgICAgICAgICAgICAgICAgIERpcmVudEJ1ZlNpemU7DQorICBVSU5UOCAgICAgICAgICAg ICAgICAgICAgICAgICAgKkRpcmVudEJ1ZjsNCisgIFVJTlROICAgICAgICAgICAgICAgICAgICAg ICAgICBTaW5nbGVGaWxlSW5mb1NpemU7DQorICBVSU5UOCAgICAgICAgICAgICAgICAgICAgICAg ICAgKkZpbGVJbmZvQXJyYXk7DQorICBVSU5UNjQgICAgICAgICAgICAgICAgICAgICAgICAgRGly U3RyZWFtQ29va2llOw0KKyAgVUlOVDY0ICAgICAgICAgICAgICAgICAgICAgICAgIENhY2hlRW5k c0F0Q29va2llOw0KKyAgVUlOVE4gICAgICAgICAgICAgICAgICAgICAgICAgIE51bUZpbGVJbmZv Ow0KKw0KKyAgLy8NCisgIC8vIEFsbG9jYXRlIGEgRGlyZW50QnVmIHRoYXQgY2FuIHJlY2VpdmUg YXQgbGVhc3QNCisgIC8vIFZJUlRJT19GU19GSUxFX01BWF9GSUxFX0lORk8gZGlyZWN0b3J5IGVu dHJpZXMsIGJhc2VkIG9uIHRoZSBtYXhpbXVtDQorICAvLyBmaWxlbmFtZSBsZW5ndGggc3VwcG9y dGVkIGJ5IHRoZSBmaWxlc3lzdGVtLiBOb3RlIHRoYXQgdGhlIG11bH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RzQXRDb29raWUgPSBWaXJ0aW9Gc0ZpbGUtPkZpbGVQb3NpdGlvbjsNCisgIE51bUZpbGVJ bmZvICAgICAgID0gMDsNCisgIGRvIHsNCisgICAgVUlOVDMyIFJlbWFpbmluZzsNCisgICAgVUlO VDMyIENvbnN1bWVkOw0KKw0KKyAgICAvLw0KKyAgICAvLyBGZXRjaCBhIGNodW5rIG9mIHRoZSBk aXJlY3Rvcnkgc3RyZWFtLiBUaGUgY2h1bmsgbWF5IGhvbGQgbW9yZSBlbnRyaWVzDQorICAgIC8v IHRoYW4gd2hhdCB3ZSBjYW4gZml0IGluIHRoZSBjYWNoZS4gVGhlIGNodW5rIG1heSBhbHNvIG5v dCBlbnRpcmVseSBmaWxsDQorICAgIC8vIHRoZSBjYWNoZSwgZXNwZWNpYWxseSBhZnRlciBmaWx0 ZXJpbmcgb3V0IGVudHJpZXMgdGhhdCBjYW5ub3QgYmUNCisgICAgLy8gc3VwcG9ydGVkIHVuZGVy IFVFRkkgKHNvY2tldHMsIEZJRk9zLCBmaWxlbmFtZXMgd2l0aCBiYWNrc2xhc2hlcywgZXRjKS4N CisgICAgLy8NCisgICAgUmVtYWluaW5nID0gRGlyZW50QnVmU2l6ZTsNCisgICAgU3RhdHVzID0g VmlydGlvRnNGdXNlUmVhZEZpbGVPckRpciAoDQorICAgICAgICAgICAgICAgVmlydGlvRnMsDQor ICAgICAgICAgICAgICAgVmlydGlvRnNGaWxlLT5Ob2RlSWQsDQorICAgICAgICAgICAgICAgVmly dGlvRnNGaWxlLT5GdXNlSGFuZGxlLA0KKyAgICAgICAgICAgICAgIFRSVUUsICAgICAgICAgICAg ICAgICAgICAgLy8gSXNEaXINCisgICAgICAgICAgICAgICBEaXJTdHJlYW1Db29raWUsICAgICAg ICAgIC8vIE9mZnNldA0KKyAgICAgICAgICAgICAgICZSZW1haW5pbmcsICAgICAgICAgICAgICAg Ly8gU2l6ZQ0KKyAgICAgICAgICAgICAgIERpcmVudEJ1ZiAgICAgICAgICAgICAgICAgLy8gRGF0 YQ0KKyAgICAgICAgICAgICAgICk7DQorICAgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsNCisg ICAgICBnb3RvIEZyZWVGaWxlSW5mb0FycmF5Ow0KKyAgICB9DQorDQorICAgIGlmIChSZW1haW5p bmcgPT0gMCkgew0KKyAgICAgIC8vDQorICAgICAgLy8gVGhlIGRpcmVjdG9yeSBzdHJlYW0gZW5k cy4NCisgICAgICAvLw0KKyAgICAgIGJyZWFrOw0KKyAgICB9DQorDQorICAgIC8vDQorICAgIC8v IEl0ZXJhdGUgb3ZlciBhbGwgcmVjb3JkcyBpbiBEaXJlbnRCdWYuIFByaW1hcmlseSwgZm9yZ2V0 IHRoZW0gYWxsLg0KKyAgICAvLyBTZWNvbmRhcmlseSwgaWYgYSByZWNvcmQgcHJvdmVzIHRyYW5z Zm9ybWFibGUgdG8gRUZJX0ZJTEVfSU5GTywgYWRkIGl0DQorICAgIC8vIHRvIHRoZSBFRklfRklM RV9JTkZPIGNhY2hlICh1bmxlc3MgdGhlIGNhY2hlIGlzIGZ1bGwpLg0KKyAgICAvLw0KKyAgICBD b25zdW1lZCA9IDA7DQorICAgIHdoaWxlIChSZW1haW5pbmcgPj0gc2l6ZW9mIChWSVJUSU9fRlNf RlVTRV9ESVJFTlRQTFVTX1JFU1BPTlNFKSkgew0KKyAgICAgIFZJUlRJT19GU19GVVNFX0RJUkVO VFBMVVNfUkVTUE9OU0UgKkRpcmVudDsNCisgICAgICBVSU5UMzIgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIERpcmVudFNpemU7DQorDQorICAgICAgRGlyZW50ID0gKFZJUlRJT19GU19GVVNF X0RJUkVOVFBMVVNfUkVTUE9OU0UgKikoRGlyZW50QnVmICsgQ29uc3VtZWQpOw0KKyAgICAgIERp cmVudFNpemUgPSAoVUlOVDMyKVZJUlRJT19GU19GVVNFX0RJUkVOVFBMVVNfUkVTUE9OU0VfU0la RSAoDQorICAgICAgICAgICAgICAgICAgIC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yA9IChFRklfRklMRV9JTkZPICopKEZpbGVJbmZvQXJyYXkgKw0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoTnVtRmlsZUluZm8gKiBTaW5nbGVG aWxlSW5mb1NpemUpKTsNCisgICAgICAgIFN0YXR1cyA9IFBvcHVsYXRlRmlsZUluZm8gKERpcmVu dCwgU2luZ2xlRmlsZUluZm9TaXplLCBGaWxlSW5mbyk7DQorICAgICAgICBpZiAoIUVGSV9FUlJP UiAoU3RhdHVzKSkgew0KKyAgICAgICAgICAvLw0KKyAgICAgICAgICAvLyBEaXJlbnQgaGFzIGJl ZW4gdHJhbnNmb3JtZWQgYW5kIGNhY2hlZCBzdWNjZXNzZnVsbHkuDQorICAgICAgICAgIC8vDQor ICAgICAgICAgIE51bUZpbGVJbmZvKys7DQorICAgICAgICAgIC8vDQorICAgICAgICAgIC8vIFRo ZSBuZXh0IHRpbWUgd2UgcmVmaWxsIHRoZSBjYWNoZSwgcmVzdGFydCByZWFkaW5nIHRoZSBkaXJl Y3RvcnkNCisgICAgICAgICAgLy8gc3RyZWFtIHJpZ2h0IGFmdGVyIHRoZSBlbnRyeSB0aGF0IHdl J3ZlIGp1c3QgdHJhbnNmb3JtZWQgYW5kDQorICAgICAgICAgIC8vIGNhY2hlZC4NCisgICAgICAg ICAgLy8NCisgICAgICAgICAgQ2FjaGVFbmRzQXRDb29raWUgPSBEaXJlbnQtPkNvb2tpZUZvck5l eHRFbnRyeTsNCisgICAgICAgIH0NCisgICAgICAgIC8vDQorICAgICAgICAvLyBJZiBEaXJlbnQg d2Fzbid0IHRyYW5zZm9ybWFibGUgdG8gYW4gRUZJX0ZJTEVfSU5GTywgd2UnbGwganVzdCBza2lw DQorICAgICAgICAvLyBpdC4NCisgICAgICAgIC8vDQorICAgICAgfQ0KKw0KKyAgICAgIC8vDQor ICAgICAgLy8gTWFrZSB0aGUgVmlydGlvIEZpbGVzeXN0ZW0gZGV2aWNlIGZvcmdldCB0aGUgTm9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