From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail.x-arc.de ([217.6.246.34] helo=root.phytec.de) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eb5BB-00063x-9o for barebox@lists.infradead.org; Mon, 15 Jan 2018 13:52:03 +0000 References: <1513266697-324-1-git-send-email-d.schultz@phytec.de> From: Daniel Schultz Message-ID: <7a777aba-c88f-91c0-1b13-8aceee7313a3@phytec.de> Date: Mon, 15 Jan 2018 14:52:55 +0100 MIME-Version: 1.0 In-Reply-To: <1513266697-324-1-git-send-email-d.schultz@phytec.de> Content-Language: en-GB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 1/2] common: state: Add property to protect existing data To: barebox@lists.infradead.org, Sascha Hauer SGksCgpqdXN0IHdhbnRlZCB0byByZW1pbmQgeW91IHRvIHRoZXNlIHBhdGNoZXMuCgpEYW5pZWwK CgpPbiAxMi8xNC8yMDE3IDA0OjUxIFBNLCBEYW5pZWwgU2NodWx0eiB3cm90ZToKPiBBZnRlciBh biB1cGRhdGUgdG8gYSBuZXdlciBiYXJlYm94IHZlcnNpb24gd2l0aCBhbiBlbmFibGVkIHN0YXRl Cj4gZnJhbWV3b3JrLCBleGlzdGluZyBkYXRhIGluIHN0b3JhZ2UgbWVtb3JpZXMgY291bGQgYmUg b3ZlcndyaXR0ZW4uCj4KPiBBZGQgYSBuZXcgcHJvcGVydHkgdG8gY2hlY2sgaW4gZnJvbnQgb2Yg ZXZlcnkgd3JpdGUgdGFzaywgaWYgdGhlIG1ldGEKPiBtYWdpYyBmaWVsZCBvbmx5IGNvbnRhaW5z IHRoZSBtYWdpYyBudW1iZXIsIHplcm9zIG9yIG9uZXMuCj4KPiBTaWduZWQtb2ZmLWJ5OiBEYW5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