From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WJ7k1-0002cy-Fz for barebox@lists.infradead.org; Thu, 27 Feb 2014 20:39:39 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 27 Feb 2014 21:39:05 +0100 Message-Id: <1393533550-1865-6-git-send-email-u.kleine-koenig@pengutronix.de> In-Reply-To: <1393533550-1865-1-git-send-email-u.kleine-koenig@pengutronix.de> References: <1393533550-1865-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 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: [PATCH v2 05/10] devfs: partitioning: add new helper devfs_create_partitions To: barebox@lists.infradead.org Q29tcGFyZWQgdG8gZGV2ZnNfYWRkX3BhcnRpdGlvbiB3aGljaCBhZGRzIGEgc2luZ2xlIHBhcnRp dGlvbgpkZXZmc19jcmVhdGVfcGFydGl0aW9ucyBjcmVhdGVzIHNldmVyYWwgcGFydGl0aW9ucyBh dCBvbmNlLiBPbmUgbmljZQpiZW5lZml0IGlzIHRoYXQgdGhpcyBzaW1wbGlmaWVzIGFwcGVuZGlu ZyBwYXJ0aXRpb25zIGJlY2F1c2UgdGhlIHN0YXJ0Cm9mIHRoZSBsYXR0ZXIgcGFydGl0aW9uIGRv ZXNuJ3QgbmVlZCB0byBiZSBzcGVjaWZpZWQgZXhwbGljaXRseS4KQWxzbyBkZXZfYWRkX2JiX2Rl digpIGlzIGNhbGxlZCBieSB0aGUgbmV3IGhlbHBlciBpZiB0aGUgYmJuYW1lIGlzCnNwZWNpZmll ZCBmb3IgYSBwYXJ0aXRpb24uCgpOb3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