From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aGOrX-0000Lq-Q3 for barebox@lists.infradead.org; Tue, 05 Jan 2016 10:29:13 +0000 Received: by mail-qg0-x22a.google.com with SMTP id 6so196431528qgy.1 for ; Tue, 05 Jan 2016 02:28:51 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1451981463-23604-4-git-send-email-mkl@pengutronix.de> References: <1451981463-23604-1-git-send-email-mkl@pengutronix.de> <1451981463-23604-4-git-send-email-mkl@pengutronix.de> From: Yegor Yefremov Date: Tue, 5 Jan 2016 11:28:31 +0100 Message-ID: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 3/3] bootm: add initial FIT support To: Marc Kleine-Budde Cc: barebox , kernel@pengutronix.de SGkgTWFyYywKCnRoYW5rcyBmb3IgcmVwb3N0aW5nIHRoZSBwYXRjaGVzLgoKT24gVHVlLCBKYW4g NSwgMjAxNiBhdCA5OjExIEFNLCBNYXJjIEtsZWluZS1CdWRkZSA8bWtsQHBlbmd1dHJvbml4LmRl PiB3cm90ZToKPiBGcm9tOiBKYW4gTHVlYmJlIDxqbHVAcGVuZ3V0cm9uaXguZGU+Cj4KPiBUaGlz IGltcGxlbWVudGF0aW9uIGlzIGluc3BpcmVkIGJ5IFUtQm9vdCdzIEZJVCBzdXBwb3J0LiBJbnN0 ZWFkIG9mCj4gdXNpbmcgbGliZmR0ICh3aGljaCBkb2VzIG5vdCBleGlzdCBpbiBiYXJlYm94KSwg Y29uZmlndXJhdGlvbiBzaWduYXR1cmVzCj4gYXJlIHZlcmlmaWVkIGJ5IHVzaW5nIGEgc2ltcGxp ZmllZC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9zdGFydF9hbmRfc2l6ZSgmbWVtX3N0YXJ0LCAmbWVtX3NpemUpOwo+ICsgICAg ICAgaWYgKHJldCkKPiArICAgICAgICAgICAgICAgcmV0dXJuIHJldDsKPiArCj4gKyAgICAgICAv KiBubyBzdXBwb3J0IGZvciBjdXN0b20gbG9hZCBhZGRyZXNzICovCj4gKyAgICAgICBkYXRhLT5v c19hZGRyZXNzID0gbWVtX3N0YXJ0ICsgUEFHRV9BTElHTihoYW5kbGUtPmtlcm5lbF9zaXplICog NCk7Cj4gKyAgICAgICBkYXRhLT5vc19yZXMgPSByZXF1ZXN0X3NkcmFtX3JlZ2lvbigiZml0LWtl cm5lbCIsIGRhdGEtPm9zX2FkZHJlc3MsIGhhbmRsZS0+a2VybmVsX3NpemUpOwo+ICsgICAgICAg aWYgKCFkYXRhLT5vc19yZXMpIHsKPiArICAgICAgICAgICAgICAgcHJfZXJyKCJDYW5ub3QgcmVx dWVzdCByZWdpb24gMHglMDhseCAtIDB4JTA4bHhcbiIsCj4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBkYXRhLT5vc19hZGRyZXNzLCBoYW5kbGUtPmtlcm5lbF9zaXplKTsKPiArICAg ICAgICAgICAgICAgcmV0ID0gLUVOT01FTTsKPiArICAgICAgICAgICAgICAgZ290byBlcnJfb3V0 Owo+ICsgICAgICAgfQo+ICsgICAgICAgbWVtY3B5KCh2b2lkICopZGF0YS0+b3NfcmVzLT5zdGFy dCwgaGFuZGxlLT5rZXJuZWwsIGhhbmRsZS0+a2VybmVsX3NpemUpOwo+ICsKPiArICAgICAgIC8q Cj4gKyAgICAgICAgKiBQdXQgb2Z0cmVlL2luaXRyZCBjbG9zZSBiZWhpbmQgY29tcHJlc3NlZCBr ZXJuZWwgaW1hZ2UgdG8gYXZvaWQKPiArICAgICAgICAqIHBsYWNpbmcgaXQgb3V0c2lkZSBvZiB0 aGUga2VybmVscyBsb3dtZW0uCj4gKyAgICAgICAgKi8KPiArICAgICAgIGlmICho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2ggKHRhZykgewo+ICsgICAgICAgICAgICAgICBj YXNlIEZEVF9CRUdJTl9OT0RFOgo+ICsgICAgICAgICAgICAgICAgICAgICAgIGZuaCA9IGZpdCAr IGR0X3N0cnVjdDsKPiArICAgICAgICAgICAgICAgICAgICAgICBuYW1lID0gZm5oLT5uYW1lOwo+ ICsgICAgICAgICAgICAgICAgICAgICAgIG1heGxlbiA9ICh1bnNpZ25lZCBsb25nKWZkdCArIGYu b2ZmX2R0X3N0cnVjdCArCj4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmLnNpemVf ZHRfc3RydWN0IC0gKHVuc2lnbmVkIGxvbmcpbmFtZTsKPiArCj4gKyAgICAgICAgICAgICAgICAg ICAgICAgbGVuID0gc3RybmxlbihuYW1lLCBtYXhsZW4gKyAxKTsKPiArICAgICAgICAgICAgICAg ICAgICAgICBpZiAobGVuID4gbWF4bGVuKQo+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgcmV0dXJuIC1FU1BJUEU7Cj4gKwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGR0X3N0cnVj dCA9IGR0X3N0cnVjdF9hZHZhbmNlKCZmLCBkdF9zdHJ1Y3QsCj4gKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2l6ZW9mKHN0cnVjdCBmZHRfbm9k ZV9oZWFkZXIpICsgbGVuICsgMSk7Cj4gKwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGRlcHRo Kys7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgaWYgKGRlcHRoID09IEZEVF9NQVhfREVQVEgp Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gLUVTUElQRTsKPiArICAg ICAgICAgICAgICAgICAgICAgICBpZiAoZW5kIC0gcGF0aCArIDIgKyBsZW4gPj0gRkRUX01BWF9Q QVRIX0xFTikKPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtRVNQSVBF Owo+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmIChlbmQgIT0gcGF0aCArIDEpCj4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAqZW5kKysgPSAnLyc7Cj4gKyAgICAgICAgICAgICAg ICAgICAgICAgc3RyY3B5KGVuZCwgbmFtZSk7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgZW5k ICs9IGxlbjsKPiArICAgICAgICAgICAgICAgICAgICAgICBzdGFja1tkZXB0aF0gPSB3YW50Owo+ ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICh3YW50ID09IDEpCj4gKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBzdG9wX2F0ID0gb2Zmc2V0Owo+ICsgICAgICAgICAgICAgICAgICAg ICAgIGlmIChzdHJpbmdfbGlzdF9jb250YWlucyhpbmNfbm9kZXMsIHBhdGgpKQo+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgd2FudCA9IDI7Cj4gKyAgICAgICAgICAgICAgICAgICAg ICAgZWxzZSBpZiAod2FudCkKPiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdhbnQt LTsKPiArICAgICAgICAgICAgICAgICAgICAgICBlbHNlCj4gKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBzdG9wX2F0ID0gb2Zmc2V0Owo+ICsgICAgICAgICAgICAgICAgICAgICAgIGlu Y2x1ZGUgPSB3YW50Owo+ICsKPiArICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKPiArCj4g KyAgICAgICAgICAgICAgIGNhc2UgRkRUX0VORF9OT0RFOgo+ICsgICAgICAgICAgICAgICAgICAg ICAgIGR0X3N0cnVjdCA9IGR0X3N0cnVjdF9hZHZhbmNlKCZmLCBkdF9zdHJ1Y3QsIEZEVF9UQUdT SVpFKTsKPiArCj4gKyAgICAgICAgICAgICAgICAgICAgICAgaW5jbHVkZSA9IHdhbnQ7Cj4gKyAg ICAgICAgICAgICAgICAgICAgICAgd2FudCA9IHN0YWNrW2RlcHRoLS1dOwo+ICsgICAgICAgICAg ICAgICAgICAgICAgIHdoaWxlIChlbmQgPiBwYXRoICYmICotLWVuZCAhPSAnLycpCj4gKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICA7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgKmVu ZCA9ICdcMCc7Cj4gKwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrOwo+ICsKPiArICAg ICAgICAgICAgICAgY2FzZSBGRFRfUFJPUDoKPiArICAgICAgICAgICAgICAgICAgICAgICBmZHRf cHJvcCA9IGZpdCArIGR0X3N0cnVjdDsKPiArICAgICAgICAgICAgICAgICAgICAgICBsZW4gPSBm ZHQzMl90b19jcHUoZmR0X3Byb3AtPmxlbik7Cj4gKwo+ICsgICAgICAgICAgICAgICAgICAgICAg IG5hbWUgPSBkdF9zdHJpbmcoJmYsIGR0X3N0cmluZ3MsIGZkdDMyX3RvX2NwdShmZHRfcHJvcC0+ bmFtZW9mZikpOwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGlmICghbmFtZSkKPiArICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAtRVNQSVBFOwo+ICsKPiArICAgICAgICAg ICAgICAgICAgICAgICBkdF9zdHJ1Y3QgPSBkdF9zdHJ1Y3RfYWR2YW5jZSgmZiwgZHRfc3RydWN0 LAo+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IHNpemVvZihzdHJ1Y3QgZmR0X3Byb3BlcnR5KSArIGxlbik7Cj4gKwo+ICsgICAgICAgICAgICAg ICAgICAgICAgIGluY2x1ZGUgPSB3YW50ID49IDI7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAg c3RvcF9hdCA9IG9mZnNldDsKPiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoc3RyaW5nX2xp c3RfY29udGFpbnMoZXhjX3Byb3BzLCBuYW1lKSkKPiArICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGluY2x1ZGUgPSAwOwo+ICsKPiArICAgICAgICAgICAgICAgICAgICAgICBicmVhazsK PiArCj4gKyAgICAgICAgICAgICAgIGNhc2UgRkRUX05PUDoKPiArICAgICAgICAgICAgICAgICAg ICAgICBkdF9zdHJ1Y3QgPSBkdF9zdHJ1Y3RfYWR2YW5jZSgmZiwgZHRfc3RydWN0LCBGRFRfVEFH U0laRSk7Cj4gKwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGluY2x1ZGUgPSB3YW50ID49IDI7 Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgc3RvcF9hdCA9IG9mZnNldDsKPiArCj4gKyAgICAg ICAgICAgICAgICAgICAgICAgYnJlYWs7Cj4gKwo+ICsgICAgICAgICAgICAgICBjYXNlIEZEVF9F TkQ6Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgZHRfc3RydWN0ID0gZHRfc3RydWN0X2FkdmFu Y2UoJmYsIGR0X3N0cnVjdCwgRkRUX1RBR1NJWkUpOwo+ICsKPiArICAgICAgICAgICAgICAgICAg ICAgICBpbmNsdWRlID0gMTsKPiArCj4gKyAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7Cj4g Kwo+ICsgICAgICAgICAgICAgICBkZWZhdWx0Ogo+ICsgICAgICAgICAgICAgICAgICAgICAgIHBy X2VycigiJXM6IFVua25vd24gdGFnIDB4JTA4WFxuIiwgX19mdW5jX18sIHRhZyk7Cj4gKyAgICAg ICAgICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Cj4gKyAgICAgICAgICAgICAgIH0KPiAr Cj4gKyAgICAgICAgICAgICAgIGlmICghZHRfc3RydWN0KQo+ICsgICAgICAgICAgICAgICAgICAg ICAgIHJldHVybiAtRVNQSVBFOwo+ICsKPiArICAgICAgICAgICAgICAgcHJfZGVidWcoIiVzOiBp bmNsdWRlICVkLCB3YW50ICVkLCBvZmZzZXQgMHgleCwgbGVuIDB4JXhcbiIsCj4gKyAgICAgICAg ICAgICAgICAgICAgICAgIHBhdGgsIGluY2x1ZGUsIHdhbnQsIG9mZnNldCwgZHRfc3RydWN0LW9m ZnNldCk7Cj4gKwo+ICsgICAgICAgICAgICAgICBpZiAoaW5jbHVkZSAmJiBzdGFydCA9PSAtMSkK PiArICAgICAgICAgICAgICAgICAgICAgICBzdGFydCA9IG9mZnNldDsKPiArCj4gKyAgICAgICAg ICAgICAgIGlmICghaW5jbHVkZSAmJiBzdGFydCAhPSAtMSkgewo+ICsgICAgICAgICAgICAgICAg ICAgICAgIHByX2RlYnVnKCJyZWdpb246IDB4JXArMHgleFxuIiwgZml0K3N0YXJ0LCBvZmZzZXQt c3RhcnQpOwo+ICsgICAgICAgICAgICAgICAgICAgICAgIGRpZ2VzdF91cGRhdGUoZGlnZXN0LCBm aXQrc3RhcnQsIG9mZnNldC1zdGFydCk7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgc3RhcnQg PSAtMTsKPiArICAgICAgICAgICAgICAgfQo+ICsgICAgICAgfSB3aGlsZSAodGFnICE9IEZEVF9F TkQpOwo+ICsKPiArICAgICAgIHByX2RlYnVnKCJyZWdpb246IDB4JXArMHgleFxuIiwgZml0K3N0 YXJ0LCBkdF9zdHJ1Y3Qtc3RhcnQpOwo+ICsgICAgICAgZGlnZXN0X3VwZGF0ZShkaWdlc3QsIGZp dCtzdGFydCwgZHRfc3RydWN0LXN0YXJ0KTsKPiArCj4gKyAgICAgICBwcl9kZWJ1Zygic3RyaW5n czogMHglcCsweCV4XG4iLCBkdF9zdHJpbmdzK2hhc2hlZF9zdHJpbmdzX3N0YXJ0LCBoYXNoZWRf c3RyaW5nc19zaXplKTsKPiArICAgICAgIGRpZ2VzdF91cGRhdGUoZGlnZXN0LCBkdF9zdHJpbmdz K2hhc2hlZF9zdHJpbmdzX3N0YXJ0LCBoYXNoZWRfc3RyaW5nc19zaXplKTsKPiArCj4gKyAgICAg ICByZXR1cm4gMDsKPiArfQo+ICsKP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tZSwgInNoYTEscnNhMjA0OCIpID09IDApIHsK PiArICAgICAgICAgICAgICAgYWxnbyA9IEhBU0hfQUxHT19TSEExOwo+ICsgICAgICAgfSBlbHNl IGlmIChzdHJjbXAoYWxnb19uYW1lLCAic2hhMjU2LHJzYTQwOTYiKSA9PSAwKSB7Cj4gKyAgICAg ICAgICAgICAgIGFsZ28gPSBIQVNIX0FMR09fU0hBMjU2Owo+ICsgICAgICAgfSBlbHNlICB7Cj4g KyAgICAgICAgICAgICAgIHByX2VycigidW5rbm93biBhbGdvICVzXG4iLCBhbGdvX25hbWUpOwo+ ICsgICAgICAgICAgICAgICByZXQgPSAtRUlOVkFMOwo+ICsgICAgICAgICAgICAgICBnb3RvIG91 dDsKPiArICAgICAgIH0KPiArICAgICAgIGRpZ2VzdCA9IGRpZ2VzdF9hbGxvY19ieV9hbGdvKGFs Z28pOwo+ICsgICAgICAgaWYgKCFkaWdlc3QpIHsKPiArICAgICAgICAgICAgICAgcHJfZXJyKCJ1 bnN1cHBvcnRlZCBhbGdvICVzXG4iLCBhbGdvX25hbWUpOwo+ICsgICAgICAgICAgICAgICByZXQg PSAtRUlOVkFMOwo+ICsgICAgICAgICAgICAgICBnb3RvIG91dDsKPiArICAgICAgIH0KPiArCj4g KyAgICAgICBzaWdfdmFsdWUgPSBvZl9nZXRfcHJvcGVydHkoc2lnX25vZGUsICJ2YWx1ZSIsICZz aWdfbGVuKTsKPiArICAgICAgIGlmICghc2lnX3ZhbHVlKSB7Cj4gKyAgICAgICAgICAgICAgIHBy X2Vycigic2lnbmF0dXJlIHZhbHVlIG5vdCBmb3VuZFxuIik7Cj4gKyAgICAgICAgICAgICAgIHJl dCA9IC1FSU5WQUw7Cj4gKyAgICAgICAgICAgICAgIGdvdG8gb3V0X2ZyZWVfZGlnZXN0Owo+ICsg ICAgICAgfQo+ICsKPiArICAgICAgIGlmIChvZl9wcm9wZXJ0eV9yZWFkX3N0cmluZyhzaWdfbm9k ZSwgImtleS1uYW1lLWhpbnQiLCAma2V5X25hbWUpKSB7Cj4gKyAgICAgICAgICAgICAgIHByX2Vy cigia2V5IG5hbWUgbm90IGZvdW5kXG4iKTsKPiArICAgICAgICAgICAgICAgcmV0ID0gLUVJTlZB TDsKPiArICAgICAgICAgICAgICAgZ290byBvdXRfZnJlZV9kaWdlc3Q7Cj4gKyAgICAgICB9Cj4g KyAgICAgICBrZXlfcGF0aCA9IGFzcHJpbnRmKCIvc2lnbmF0dXJlL2tleS0lcyIsIGtleV9uYW1l KTsKPiArICAgICAgIGlmICgha2V5X25hbWUpIHsKPiArICAgICAgICAgICAgICAgcmV0ID0gLUVO T01FTTsKPiArICAgICAgICAgICAgICAgZ290byBvdXRfZnJlZV9kaWdlc3Q7Cj4gKyAgICAgICB9 Cj4gKyAgICAgICBrZXlfbm9kZSA9IG9mX2ZpbmRfbm9kZV9ieV9wYXRoKGtleV9wYXRoKTsKPiAr ICAgICAgIGZyZWUoa2V5X3BhdGgpOwo+ICsgICAgICAgaWYgKCFrZXlfbm9kZSkgewo+ICsgICAg ICAgICAgICAgICBwcl9pbmZvKCJmYWlsZWQgdG8gZmluZCBrZXkgbm9kZVxuIik7Cj4gKyAgICAg ICAgICAgICAgIHJldCA9IC1FTk9FTlQ7Cj4gKyAgICAgICAgICAgICAgIGdvdG8gb3V0X2ZyZWVf ZGlnZXN0Owo+ICsgICAgICAgfQo+ICsKPiArICAgICAgIHJldCA9IHJzYV9vZl9yZWFkX2tleShr ZXlfbm9kZSwgJmtleSk7Cj4gKyAgICAgICBpZiAocmV0KSB7Cj4gKyAgICAgICAgICAgICAgIHBy X2luZm8oImZhaWxlZCB0byByZWFkIGtleVxuIik7Cj4gKyAgICAgICAgICAgICAgIHJldCA9IC1F Tk9FTlQ7Cj4gKyAgICAgICAgICAgICAgIGdvdG8gb3V0X2ZyZWVfZGlnZXN0Owo+ICsgICAgICAg fQo+ICsKPiArICAgICAgIGlmIChvZl9wcm9wZXJ0eV9yZWFkX3UzMl9pbmRleChzaWdfbm9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BoYXNoKSB7Cj4gKyAg ICAgICAgICAgICAgIGlmIChoYW5kbGUtPnZlcmJvc2UpCj4gKyAgICAgICAgICAgICAgICAgICAg ICAgb2ZfcHJpbnRfbm9kZXMoaGFzaCwgMCk7Cj4gKyAgICAgICAgICAgICAgIHJldCA9IGZpdF92 ZXJpZnlfaGFzaChoYXNoLCBkYXRhLCBkYXRhX2xlbik7Cj4gKyAgICAgICAgICAgICAgIGlmIChy ZXQgPCAwKQo+ICsgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXQ7Cj4gKyAgICAgICAg ICAgICAgIGxldmVsID0gbWluKGxldmVsLCByZXQpOwo+ICsgICAgICAgfQo+ICsgICAgICAgaWYg KGxldmVsID09IENIRUNLX0xFVkVMX01BWCkgewo+ICsgICAgICAgICAgICAgICByZXR1cm4gLUVJ TlZBTDsKPiArICAgICAgIH0KPiArCj4gKyAgICAgICBpZiAobGV2ZWwgPT0gQ0hFQ0tfTEVWRUxf SEFTSCkgewo+ICsgICAgICAgICAgICAgICBpZiAoc3RyY21wKHR5cGUsICJrZXJuZWwiKSA9PSAw IHx8Cj4gKyAgICAgICAgICAgICAgICAgICBzdHJjbXAodHlwZSwgImtlcm5lbF9ub2xvYWQiKSA9 PSAwKSB7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlLT5rZXJuZWwgPSBkYXRhOwo+ ICsgICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZS0+a2VybmVsX3NpemUgPSBkYXRhX2xlbjsK PiArICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdHJjbXAodHlwZSwgImZsYXRfZHQiKSA9PSAw KSB7Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlLT5vZnRyZWUgPSBkYXRhOwo+ICsg ICAgICAgICAgICAgICAgICAgICAgIGhhbmRsZS0+b2Z0cmVlX3NpemUgPSBkYXRhX2xlbjsKPiAr ICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzdHJjbXAodHlwZSwgInJhbWRpc2siKSA9PSAwKSB7 Cj4gKyAgICAgICAgICAgICAgICAgICAgICAgaGFuZGxlLT5pbml0cmQgPSBkYXRhOwo+ICsgICAg ICAgICAgICAgICAgICAgICAgIGhhbmRsZS0+aW5pdHJkX3NpemUgPSBkYXRhX2xlbjsKPiArICAg ICAgICAgICAgICAgfSBlbHNlIHsKPiArICAgICAgICAgICAgICAgICAgICAgICBwcl9pbmZvKCJ1 bmtub3duIGltYWdlIHR5cGUgJXMsIGlnbm9yaW5nXG4iLCB0eXBlKTsKPiArICAgICAgICAgICAg ICAgfQo+ICsgICAgICAgfQo+ICsKPiArICAgICAgIHJldHVybiBsZXZlbDsKPiArfQo+ICsKPiAr c3RhdGljIGludCBmaXRfb3Blbl9jb25maWd1cmF0aW9uKHN0cnVjdCBmaXRfaGFuZGxlICpoYW5k bGUsIGludCBudW0pCj4gK3sKPiArICAgICAgIHN0cnVjdCBkZXZpY2Vfbm9kZSAqY29uZl9ub2Rl ID0gTlVMTCwgKnNpZ19ub2RlOwo+ICsgICAgICAgY2hhciB1bml0X25hbWVbMTBdOwo+ICsgICAg ICAgY29uc3QgY2hhciAqdW5pdCwgKmRlc2M7Cj4gKyAgICAgICBpbnQgcmV0LCBsZXZlbDsKPiAr Cj4gKyAgICAgICBjb25mX25vZGUgPSBvZl9nZXRfY2hpbGRfYnlfbmFtZShoYW5kbGUtPnJvb3Qs ICJjb25maWd1cmF0aW9ucyIpOwo+ICsgICAgICAgaWYgKCFjb25mX25vZGUpCj4gKyAgICAgICAg ICAgICAgIHJldHVybiAtRU5PRU5UOwo+ICsKPiArICAgICAgIGlmIChudW0pIHsKPiArICAgICAg ICAgICAgICAgc25wcmludGYodW5pdF9uYW1lLCBzaXplb2YodW5pdF9uYW1lKSwgImNvbmZAJWQi LCBudW0pOwoKVGhpcyBpcyBub3Qgd29ya2luZyBmb3IgbXkgKi5pdHMgZmlsZToKaHR0cHM6Ly9n aXRodWIuY29tL3Zpc2lvbnN5c3RlbX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29uZmln dXJhdGlvbiAnJXMnIChubyBkZXNjcmlwdGlvbilcbiIsIHVuaXQpOwo+ICsgICAgICAgfSBlbHNl IHsKPiArICAgICAgICAgICAgICAgcHJfaW5mbygiRklUIGNvbmZpZ3VyYXRpb24gJyVzJzogJyVz J1xuIiwgdW5pdCwgZGVzYyk7Cj4gKyAgICAgICB9Cj4gKwo+ICsgICAgICAgbGV2ZWwgPSBDSEVD S19MRVZFTF9NQVg7Cj4gKyAgICAgICBmb3JfZWFjaF9jaGlsZF9vZl9ub2RlKGNvbmZfbm9kZSwg c2lnX25vZGUpIHsKPiArICAgICAgICAgICAgICAgaWYgKGhhbmRsZS0+dmVyYm9zZSkKPiArICAg ICAgICAgICAgICAgICAgICAgICBvZl9wcmludF9ub2RlcyhzaWdfbm9kZSwgMCk7Cj4gKyAgICAg ICAgICAgICAgIHJldCA9IGZpdF92ZXJpZnlfc2lnbmF0dXJlKHNpZ19ub2RlLCBoYW5kbGUtPmZp dCk7Cj4gKyAgICAgICAgICAgICAgIGlmIChyZXQgPCAwKQo+ICsgICAgICAgICAgICAgICAgICAg ICAgIHJldHVybiByZXQ7Cj4gKyAgICAgICAgICAgICAgIGxldmVsID0gbWluKGxldmVsLCByZXQp Owo+ICsgICAgICAgfQo+ICsgICAgICAgaWYgKGxldmVsID09IENIRUNLX0xFVkVMX01BWCkKPiAr ICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Cj4gKwo+ICsgICAgICAgaWYgKGxldmVsICE9 IENIRUNLX0xFVkVMX1NJRykKPiArICAgICAgICAgICAgICAgcmV0dXJuIC1FSU5WQUw7Cj4gKwo+ ICsgICAgICAgaWYgKG9mX3Byb3BlcnR5X3JlYWRfc3RyaW5nKGNvbmZfbm9kZSwgImtlcm5lbCIs ICZ1bml0KSA9PSAwKQo+ICsgICAgICAgICAgICAgICBsZXZlbCA9IG1pbihsZXZlbCwgZml0X29w ZW5faW1hZ2UoaGFuZGxlLCB1bml0KSk7Cj4gKyAgICAg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mVhZCAlczogJXNcbiIsIGZpbGVuYW1lLCBzdHJlcnJvcihlcnJubykpOwo+ICsgICAgICAgICAg ICAgICBnb3RvIGVycjsKPiArICAgICAgIH0KPiArCj4gKyAgICAgICBoYW5kbGUtPnJvb3QgPSBv Zl91bmZsYXR0ZW5fZHRiKGhhbmRsZS0+Zml0KTsKPiArICAgICAgIGlmIChJU19FUlIoaGFuZGxl LT5yb290KSkgewo+ICsgICAgICAgICAgICAgICBnb3RvIGVycjsKPiArICAgICAgIH0KPiArCj4g KyAgICAgICBpZiAob2ZfcHJvcGVydHlfcmVhZF9zdHJpbmcoaGFuZGxlLT5yb290LCAiZGVzY3Jp cHRpb24iLCAmZGVzYykpIHsKPiArICAgICAgICAgICAgICAgcHJfaW5mbygiRklUICclcycgKG5v IGRlc2NyaXB0aW9uKVxuIiwgZmlsZW5hbWUpOwo+ICsgICAgICAgfSBlbHNlIHsKPiArICAgICAg ICAgICAgICAgcHJfaW5mbygiRklUICclcyc6ICclcydcbiIsIGZpbGVuYW1lLCBkZXNjKTsKPiAr ICAgICAgIH0KPiArCj4gKyAgICAgICBpZiAoZml0X29wZW5fY29uZmlndXJhdGlvbihoYW5kbGUs IG51bSkpCj4gKyAgICAgICAgICAgICAgIGdvdG8gZXJyOwo+ICsKPiArICAgICAgIHJldHVybiBo YW5kbGU7Cj4gKyBlcnI6Cj4gKyAgICAgICBpZiAoaGFuZGxlLT5yb290KQo+ICsgICAgICAgICAg ICAgICBvZl9kZWxldGVfbm9kZShoYW5kbGUtPnJvb3QpOwo+ICsgICAgICAgaWYgKGhhbmRsZS0+ Zml0KQo+ICsgICAgICAgICAgICAgICBmcmVlKGhhbmRsZS0+Zml0KTsKPiArICAgICAgIGZyZWUo aGFuZGxlKTsKPiArCj4gKyAgICAgICByZXR1cm4gTlVMTDsKPiArfQo+ICsKPiArdm9pZCBmaXRf Y2xvc2Uoc3RydWN0IGZpdF9oYW5kbGUgKmhhbmRsZSkKPiArewo+ICsgICAgICAgaWYgK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