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 1Vej4I-0007oU-8X for barebox@lists.infradead.org; Fri, 08 Nov 2013 10:13:37 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 8 Nov 2013 11:13:01 +0100 Message-Id: <1383905581-28470-1-git-send-email-u.kleine-koenig@pengutronix.de> In-Reply-To: <20131108005037.GZ14892@pengutronix.de> References: <20131108005037.GZ14892@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] partitions: dos: improve guess of disk size To: barebox@lists.infradead.org VGhlIGNvZGUgdXNlZCB0byBpbmVmZmVjdGl2ZWx5IHRha2UgdGhlIGVuZCBvZiB0aGUgbGFzdCBw YXJ0aXRpb24gYXMgZ3Vlc3MKZm9yIHRoZSBkaXNrIHNpemUuIEJldHRlciB1c2UgdGhlIGVuZCBv ZiB0aGUgcGFydGl0aW9uIHRoYXQgaGFzIGl0cyBlbmQKcmVhcm1vc3QuCgpBbHNvIHJldHVybiBh biB1bnNpZ25lZCB0eXBlIGluc3RlYWQgb2YgaW50IGFzIHRoZSByZXN1bHQgaXMgYWx3YXlzCm5v bi1uZWdhdGl2ZS4KClNpZ25lZC1vZmYtYnk6IFV3ZSBLbGVpbmUtS8O2bmlnIDx1LmtsZWluZS1r b2VuaWdAcGVuZ3V0cm9uaXguZGU+Ci0tLQogY29tbW9uL3BhcnRpdGlvbnMvZG9zLmMgfCAxNCAr KysrKysrKystLS0tLQogMSBmaWxlIGNoYW5nZWQsIDkgaW5zZXJ0aW9ucygrKSwgNSBkZWxldGlv bnM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