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.web08.4374.1608156383810038864 for ; Wed, 16 Dec 2020 14:06:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FpxAI6ZR; 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=1608156383; 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=6vghUjpF4p/djeCpMgw69n6zFDMa0i9kofAES3IQSlQ=; b=FpxAI6ZRQMPa1+6TK3qkyVectFAtKd0s0IC1EcbCzjiS26LYGD8y4Or7uslCErLsLYnMkM vMLBgfz8kOXaw51CDlXzrRSGBUc+FuQcxmWJm9BXRCpBfWQbH8PBEf15vODILF09qNK46k PfZDxlztRWm+eC7l8OtxU8Dulr6By24= 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-299-5Wt_bqQ1OOuHdFqxa_rHsQ-1; Wed, 16 Dec 2020 17:06:16 -0500 X-MC-Unique: 5Wt_bqQ1OOuHdFqxa_rHsQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00E9C800D53; Wed, 16 Dec 2020 22:06:15 +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 100AB5D9C0; Wed, 16 Dec 2020 22:06: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 PATCH 26/48] OvmfPkg/VirtioFsDxe: implement EFI_FILE_PROTOCOL.Open() Date: Wed, 16 Dec 2020 22:11:03 +0100 Message-Id: <20201216211125.19496-27-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.14 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 bGVtZW50ClZpcnRpb0ZzU2ltcGxlRmlsZU9wZW4oKS4KClRoaXMgbGV0cyB0aGUgIk1LRElSIiBj b21tYW5kIHRvIHdvcmsgaW4gdGhlIFVFRkkgc2hlbGwsIGZvciBleGFtcGxlLgoKQ2M6IEFyZCBC aWVzaGV1dmVsIDxhcmQuYmllc2hldXZlbEBhcm0uY29tPgpDYzogSm9yZGFuIEp1c3RlbiA8am9y ZGFuLmwuanVzdGVuQGludGVsLmNvbT4KQ2M6IFBoaWxpcHBlIE1hdGhpZXUtRGF1ZMOpIDxwaGls bWRAcmVkaGF0LmNvbT4KUmVmOiBodHRwczovL2J1Z3ppbGxhLnRpYW5vY29yZS5vcmcvc2hvd19i dWcuY2dpP2lkPTMwOTcKU2lnbmVkLW9mZi1ieTogTGFzemxvIEVyc2VrIDxsZXJzZWtAcmVkaGF0 LmNvbT4KLS0tCiBPdm1mUGtnL1ZpcnRpb0ZzRHhlL1NpbXB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aXJlY3RvcnkNCisgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIHNob3VsZCBiZSBvcGVuZWQuDQorDQorICBAcGFyYW1bb3V0XSBOZXdIYW5k bGUgICAgICBUaGUgbmV3IEVGSV9GSUxFX1BST1RPQ09MIGluc3RhbmNlIHRocm91Z2ggd2hpY2gN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSByb290IGRpcmVjdG9yeSBjYW4gYmUg YWNjZXNzZWQuDQorDQorICBAcGFyYW1baW5dIE9wZW5Gb3JXcml0aW5nICBUUlVFIGlmIHRoZSBy b290IGRpcmVjdG9yeSBzaG91bGQgYmUgb3BlbmVkIGZvcg0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgcmVhZC13cml0ZSBhY2Nlc3MuIEZBTFNFIGlmIHRoZSByb290IGRpcmVjdG9yeQ0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2hvdWxkIGJlIG9wZW5lZCBmb3IgcmVhZC1v bmx5IGFjY2Vzcy4gT3BlbmluZyB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJv b3QgZGlyZWN0b3J5IGZvciByZWFkLXdyaXRlIGFjY2VzcyBpcyB1c2VmdWwgZm9yDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBjYWxsaW5nIEVGSV9GSUxFX1BST1RPQ09MLkZsdXNoKCkg b3INCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEVGSV9GSUxFX1BST1RPQ09MLlNldElu Zm8oKSBsYXRlciwgZm9yIHN5bmNpbmcgb3INCisgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHRvdWNoaW5nIHRoZSByb290IGRpcmVjdG9yeSwgcmVzcGVjdGl2ZWx5Lg0KKw0KKyAgQHJldHZh bCBFRklfU1VDQ0VTUyAgICAgICAgVGhlIHJvb3QgZGlyZWN0b3J5IGhhcyBiZWVuIG9wZW5lZCBz dWNjZXNzZnVsbHkuDQorDQorICBAcmV0dmFsI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GluZzsNCisgIHJldHVybiBF RklfU1VDQ0VTUzsNCit9DQorDQorLyoqDQorICBPcGVuIGFuIGV4aXN0ZW50IHJlZ3VsYXIgZmls ZSBvciBub24tcm9vdCBkaXJlY3RvcnkuDQorDQorICBAcGFyYW1baW4sb3V0XSBWaXJ0aW9GcyAg ICAgIFRoZSBWaXJ0aW8gRmlsZXN5c3RlbSBkZXZpY2Ugb24gd2hpY2ggdGhlDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHJlZ3VsYXIgZmlsZSBvciBkaXJlY3Rvcnkgc2hvdWxkIGJl IG9wZW5lZC4NCisNCisgIEBwYXJhbVtpbl0gRGlyTm9kZUlkICAgICAgICAgVGhlIGlub2RlIG51 bWJlciBvZiB0aGUgaW1tZWRpYXRlIHBhcmVudA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICBkaXJlY3Rvcnkgb2YgdGhlIHJlZ3VsYXIgZmlsZSBvciBkaXJlY3RvcnkgdG8NCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgb3Blbi4NCisNCisgIEBwYXJhbVtpbl0gTmFtZSAg ICAgICAgICAgICAgVGhlIHNpbmdsZS1jb21wb25lbnQgZmlsZW5hbWUgb2YgdGhlIHJlZ3VsYXIN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZmlsZSBvciBkaXJlY3RvcnkgdG8gb3Bl biwgdW5kZXIgdGhlIGltbWVkaWF0ZQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBw YXJlbnQgZGlyZWN0b3J5IGlkZW50aWZpZWQgYnkgRGlyTm9kZUlkLg0KKw0KKyAgQHBhcmFtW2lu XSBPcGVuRm9yV3JpdGluZyAgICBUUlVFIGlmIHRoZSByZWd1bGFyIGZpbGUgb3IgZGlyZWN0b3J5 IHNob3VsZCBiZQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvcGVuZWQgZm9yIHJl YWQtd3JpdGUgYWNjZXNzLiBGQUxTRSBpZiB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgcmVndWxhciBmaWxlIG9yIGRpcmVjdG9yeSBzaG91bGQgYmUgb3BlbmVkIGZvcg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkLW9ubHkgYWNjZXNzLiBPcGVuaW5nIGEg ZGlyZWN0b3J5IGZvcg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWFkLXdyaXRl IGFjY2VzcyBpcyB1c2VmdWwgZm9yIGRlbGV0aW5nLA0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICByZW5hbWluZywgc3luY2luZyBvciB0b3VjaGluZyB0aGUgZGlyZWN0b3J5DQorICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhdGVyLg0KKw0KKyAgQHBhcmFtW291dF0gTm9k ZUlkICAgICAgICAgICBUaGUgaW5vZGUgbnVtYmVyIG9mIHRoZSByZWd1bGFyIGZpbGUgb3INCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGlyZWN0b3J5LCByZXR1cm5lZCBieSB0aGUg VmlydGlvIEZpbGVzeXN0ZW0NCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNl Lg0KKw0KKyAgQHBhcmFtW291dF0gRnVzZUhhbmRsZSAgICAgICBUaGUgb3BlbiBoYW5kbGUgdG8g dGhlIHJlZ3VsYXIgZmlsZSBvcg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXJl Y3RvcnksIHJldHVybmVkIGJ5IHRoZSBWaXJ0aW8gRmlsZXN5c3RlbQ0KKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBkZXZpY2UuDQorDQorICBAcGFyYW1bb3V0XSBOb2RlSXNEaXJlY3Rv cnkgIFNldCB0byBUUlVFIG9uIG91dHB1dCBpZiBOYW1lIHdhcyBmb3VuZCB0byByZWZlcg0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBhIGRpcmVjdG9yeS4gU2V0IHRvIEZBTFNF IGlmIE5hbWUgd2FzIGZvdW5kDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRvIHJl ZmVyIHRvIGEgcmVndWxhciBmaWxlLg0KKw0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAgICAg VGhlIHJlZ3VsYXIgZmlsZSBvciBkaXJlY3RvcnkgaGFzIGJlZW4gbG9va2VkIHVwDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBhbmQgb3BlbmVkIHN1Y2Nlc3NmdWxseS4NCisNCisgIEBy ZXR2YWwgRUZJX0FDQ0VTU19ERU5JRUQgIE9wZW5Gb3JXcml0aW5nIGlzIFRSVUUsIGJ1dCB0aGUg cmVndWxhciBmaWxlIG9yDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXJlY3Rvcnkg aXMgbWFya2VkIHJlYWQtb25seS4NCisNCisgIEByZXR2YWwgRUZJX05PVF9GT1VORCAgICAgIEEg ZGlyZWN0b3J5IGVudHJ5IGNhbGxlZCBOYW1lIHdhcyBub3QgZm91bmQgaW4gdGhlDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBkaXJlY3RvcnkgaWRlbnRpZmllZCBieSBEaXJOb2RlSWQu IChFRklfTk9UX0ZPVU5EDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcyBub3QgcmV0 dXJuZWQgZm9yIGFueSBvdGhlciBjb25kaXRpb24uKQ0KKw0KKyAgQHJldHVybiAgICAgICAgICAg ICAgICAgICAgRXJyb3JzIHByb3BhZ2F0ZWQgZnJvbSB1bmRlcmx5aW5nIGZ1bmN0aW9ucy4gSWYN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBlcnJvciBjb2RlIHRvIHByb3BhZ2F0 ZSB3ZXJlIEVGSV9OT1RfRk9VTkQsIGl0DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICBp cyByZW1hcHBlZCB0byB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