/* print sizes as "xxx kB", "xxx.y kB", "xxx MB", "xxx.y MB", xxx GB, or xxx.y GB as needed; allow for optional trailing string (like "\n")  */
void print_size(phys_size_t size, const char *s)
/* print sizes as "xxx kB", "xxx.y kB", "xxx MB", "xxx.y MB", xxx GB, or xxx.y GB as needed; allow for optional trailing string (like "\n")  */
void print_size(phys_size_t size, const char *s)
{
	ulong m = 0, n;
	phys_size_t d = 1 << 30;
	char  c = 'G';
	if (size < d) {
		c = 'M';
		d = 1 << 20;
		if (size < d) {
			c = 'k';
			d = 1 << 10;
		}
	}
	n = size / d;
	if(size % d) {
		m = (10 * (size - (n * d)) + (d / 2) ) / d;
		if (m >= 10) {
			m -= 10;
			n += 1;
		}
	}
	printf ("%2ld", n);
	if (m) {
		printf (".%ld", m);
	}
	printf (" %cB%s", c, s);
}