From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web09.4862.1608158402654984048 for ; Wed, 16 Dec 2020 14:40:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XkxPYj4M; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608158401; 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=7bN4LLmN6+Ee0fpa+23T3As/uJXC2l1got5r8PzX690=; b=XkxPYj4MtvkbpUi+65Pp26K7mXf6ho886ozGiJ4oQ4UCkktXE+Hq/QnHq4wne2ZW2WIHrM 07xD8Au5zIS39XjQvVAX7q7/JdwIHh0g3kFXaBBh52Dvrwttjhg1Xa2MEogh55kP7ncUlv xwMxMQR9cfHsJVY0PAksqPuSunsdGQg= 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-332-x-UbvzVlOCu972sdkrg86Q-1; Wed, 16 Dec 2020 17:39:59 -0500 X-MC-Unique: x-UbvzVlOCu972sdkrg86Q-1 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 2CF4181441E; Wed, 16 Dec 2020 22:39:54 +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 72DEF62953; Wed, 16 Dec 2020 22:39:52 +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 42/48] OvmfPkg/VirtioFsDxe: add helper for composing rename/move destination path Date: Wed, 16 Dec 2020 22:11:19 +0100 Message-Id: <20201216211125.19496-43-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.15 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 VGhlIEVGSV9GSUxFX1BST1RPQ09MLlNldEluZm8oKSBtZW1iZXIgaXMgc29tZXdoYXQgdW5kZXIt c3BlY2lmaWVkOyBvbmUgb2YKaXRzIG1vZGVzIG9mIG9wZXJhdGlvbiBpcyByZW5hbWluZy9tb3Zp bmcgdGhlIGZpbGUuCgpJbiBvcmRlciB0byBjcmVhdGUgdGhlIGRlc3RpbmF0aW9uIHBhdGhuYW1l IGluIGNhbm9uaWNhbCBmb3JtYXQsIDIqMj00CmNhc2VzIGhhdmUgdG8gYmUgY29uc2lkZXJlZC4g Rm9yIHRoZSBzYWtlIG9mIGRpc2N1c3Npb24sIGFzc3VtZSB0aGUKY3VycmVudCBjYW5vbmljYWwg cGF0aG5hbWUgb2YgYSBWSVJUSU9fRlNfRklMRSBpcyAiL2hvbWUvdXNlci9mMS50eHQiLgpUaGVu LCBjb25zaWRlciB0aGUgZm9sbG93aW5nIHJlbmFtZS9tb3ZlIHJlcXVlc3RzIGZyb20KRUZJX0ZJ TEVfUFJPVE9DT0wuU2V0SW5mbygpOgoKICBEZXN0aW5hdGlvbiByZXF1ZXN0ZWQgIERl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G9ydGVkIHRocm91Z2ggUm9vdEVzY2FwZSwgd2l0aG91dCBmYWlsaW5nIHRoZSBm dW5jdGlvbiBjYWxsLg0KKw0KKyAgQHBhcmFtW2luXSBMaHNQYXRoOCAgICAgVGhlIHNvdXJjZSBw YXRobmFtZSBvcGVyYW5kIG9mIHRoZSByZW5hbWUvbW92ZQ0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgb3BlcmF0aW9uLCBleHByZXNzZWQgYXMgYSBjYW5vbmljYWwgcGF0aG5hbWUgKGFzDQor ICAgICAgICAgICAgICAgICAgICAgICAgICBkZWZpbmVkIGluIHRoZSBkZXNjcmlwdGlvbiBvZiBW aXJ0aW9Gc0FwcGVuZFBhdGgoKSkuDQorICAgICAgICAgICAgICAgICAgICAgICAgICBUaGUgcm9v dCBkaXJlY3RvcnkgIi8iIGNhbm5vdCBiZSByZW5hbWVkL21vdmVkLCBhbmQNCisgICAgICAgICAg ICAgICAgICAgICAgICAgIHdpbGwgYmUgcmVqZWN0ZWQuDQorDQorICBAcGFyYW1baW5dIFJoc1Bh dGgxNiAgICBUaGUgZGVzdGluYXRpb24gcGF0aG5hbWUgb3BlcmFuZCBleHByZXNzZWQgYXMgYQ0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgVUVGSS1zdHlsZSBDSEFSMTYgcGF0aG5hbWUuDQor DQorICAgICAgICAgICAgICAgICAgICAgICAgICBJZiBSaHNQYXRoMTYgc3RhcnRzIHdpdGggYSBi YWNrc2xhc2gsIHRoZW4gUmhzUGF0aDE2DQorICAgICAgICAgICAgICAgICAgICAgICAgICBpcyBj b25zaWRlcmVkIGFic29sdXRlLiBPdGhlcndpc2UsIFJoc1BhdGgxNiBpcw0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgaW50ZXJwcmV0ZWQgcmVsYXRpdmUgdG8gdGhlIG1vc3Qgc3BlY2lmaWMg cGFyZW50DQorICAgICAgICAgICAgICAgICAgICAgICAgICBkaXJlY3RvcnkgZm91bmQgaW4gTGhz UGF0aDguDQorDQorICAgICAgICAgICAgICAgICAgICAgICAgICBJbmRlcGVuZGVudGx5LCBpZiBS aHNQYXRoMTYgZW5kcyB3aXRoIGEgYmFja3NsYXNoDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAoaS5lLiwgUmhzUGF0aDE2IGlzIGdpdmVuIGluIHRoZSAibW92ZSBpbnRvDQorICAgICAgICAg ICAgICAgICAgICAgICAgICBkaXJlY3RvcnkiIGNvbnZlbmllbmNlIGZvcm0pLCB0aGVuIFJoc1Bh dGgxNiBpcw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgaW50ZXJwcmV0ZWQgd2l0aCB0aGUg YmFzZW5hbWUgb2YgTGhzUGF0aDggYXBwZW5kZWQuDQorICAgICAgICAgICAgICAgICAgICAgICAg ICBPdGhlcndpc2UsIHRoZSBsYXN0IHBhdGhuYW1lIGNvbXBvbmVudCBvZiBSaHNQYXRoMTYNCisg ICAgICAgICAgICAgICAgICAgICAgICAgIGlzIHRha2VuIGFzIHRoZSBsYXN0IHBhdGhuYW1lIGNv bXBvbmVudCBvZiB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbmFtZS9tb3ZlIGRl c3RpbmF0aW9uLg0KKw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgQW4gZW1wdHkgUmhzUGF0 aDE2IGlzIHJlamVjdGVkLg0KKw0KKyAgQHBhcmFtW291dF0gUmVzdWx0UGF0aDggIFRoZSBQT1NJ WC1zdHlsZSwgY2Fub25pY2FsIGZvcm1hdCBwYXRobmFtZSB0aGF0DQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgbGVhZHMgdG8gdGhlIHJlbmFtZWQvbW92ZWQgZmlsZS4gQWZ0ZXIgdXNlLCB0 aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAgICBjYWxsZXIgaXMgcmVzcG9uc2libGUgZm9y IGZyZWVpbmcgUmVzdWx0UGF0aDguDQorDQorICBAcGFyYW1bb3V0XSBSb290RXNjYXBlICAgU2V0 IHRvIFRSVUUgaWYgYXQgbGVhc3Qgb25lIGRvdC1kb3QgY29tcG9uZW50IGluDQorICAgICAgICAg ICAgICAgICAgICAgICAgICAgUmhzUGF0aDE2IGF0dGVtcHRlZCB0byBlc2NhcGUgdGhlIHJvb3Qg ZGlyZWN0b3J5Ow0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgIHNldCB0byBGQUxTRSBvdGhl cndpc2UuDQorDQorICBAcmV0dmFsIEVGSV9TVUNDRVNTICAgICAgICAgICAgUmVzdWx0UGF0aDgg aGFzIGJlZW4gcHJvZHVjZWQuIFJvb3RFc2NhcGUgaGFzDQorICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgYmVlbiBvdXRwdXQuDQorDQorICBAcmV0dmFsIEVGSV9JTlZBTElEX1BBUkFN RVRFUiAgTGhzUGF0aDggaXMgIi8iLg0KKw0KKyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVU RVIgIFJoc1BhdGgxNiBpcyB6ZXJvLWxlbmd0aC4NCisNCisgIEByZXR2YWwgRUZJX0lOVkFMSURf UEFSQU1FVEVSICBSaHNQYXRoMTYgZmFpbGVkIHRoZQ0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIFZJUlRJT19GU19NQVhfUEFUSE5BTUVfTEVOR1RIIGNoZWNrLg0KKw0KKyAgQHJl dHZhbCBFRklfT1VUX09GX1JFU09VUkNFUyAgIE1lbW9yeSBhbGxvY2F0aW9uIGZhaWxlZC4NCisN CisgIEByZXR2YWwgRUZJX09VVF9PRl9SRVNPVVJDRVMgICBSZXN1bHRQYXRoOCB3b3VsZCBoYXZl IGZhaWxlZCB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBWSVJUSU9fRlNf TUFYX1BBVEhOQU1FX0xFTkdUSCBjaGVjay4NCisNCisgIEByZXR2YWwgRUZJX1VOU1VQUE9SVEVE ICAgICAgICBSaHNQYXRoMTYgY29udGFpbnMg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