mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 8/9] use %W instead of size_human_readable and use IEEE 1541 format
Date: Thu,  2 Sep 2010 16:10:23 +0200	[thread overview]
Message-ID: <1283436624-29567-8-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20100902141001.GA28968@game.jcrosoft.org>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/bootm.c      |    7 ++---
 common/startup.c      |    9 +++----
 include/common.h      |    1 -
 lib/Makefile          |    1 -
 lib/display_options.c |   60 -------------------------------------------------
 5 files changed, 7 insertions(+), 71 deletions(-)
 delete mode 100644 lib/display_options.c

diff --git a/commands/bootm.c b/commands/bootm.c
index 11325dc..ea6b5d7 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -552,11 +552,11 @@ print_image_hdr (image_header_t *hdr)
 	printf ("   Image Type:   %s %s %s (%s)\n", image_arch(hdr), image_os(hdr),
 			image_type(hdr), image_compression(hdr));
 #endif
-	printf ("   Data Size:    %d Bytes = %s\n"
+	printf ("   Data Size:    %d Bytes = %WiB\n"
 		"   Load Address: %08x\n"
 		"   Entry Point:  %08x\n",
 			ntohl(hdr->ih_size),
-			size_human_readable(ntohl(hdr->ih_size)),
+			ntohl(hdr->ih_size),
 			ntohl(hdr->ih_load),
 			ntohl(hdr->ih_ep));
 
@@ -567,8 +567,7 @@ print_image_hdr (image_header_t *hdr)
 
 		puts ("   Contents:\n");
 		for (i=0; (len = ntohl(*len_ptr)); ++i, ++len_ptr) {
-			printf ("   Image %d: %8ld Bytes = %s", i, len,
-				size_human_readable (len));
+			printf ("   Image %d: %8ld Bytes = %WiB", i, len, len);
 		}
 	}
 }
diff --git a/common/startup.c b/common/startup.c
index 2ed16fe..ff9da3a 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -52,12 +52,11 @@ static void display_meminfo(void)
 
 	debug("barebox code : 0x%08lX -> 0x%08lX  BSS: -> 0x%08lX\n",
 	       _barebox_start, _bss_start, _bss_end);
-	printf("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n",
-		mstart, mend, size_human_readable(msize));
+	printf("Malloc space: 0x%08lx -> 0x%08lx (size %WiB)\n",
+		mstart, mend, msize);
 #ifdef CONFIG_ARM
-	printf("Stack space : 0x%08lx -> 0x%08lx (size %s)\n",
-		STACK_BASE, STACK_BASE + STACK_SIZE,
-		size_human_readable(STACK_SIZE));
+	printf("Stack space : 0x%08lx -> 0x%08lx (size %WiB)\n",
+		STACK_BASE, STACK_BASE + STACK_SIZE, STACK_SIZE);
 #endif
 }
 
diff --git a/include/common.h b/include/common.h
index 64f49db..fda04d4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -95,7 +95,6 @@ void __noreturn panic(const char *fmt, ...);
 
 /* */
 long int initdram (int);
-char *size_human_readable(ulong size);
 
 /* common/main.c */
 int	run_command	(const char *cmd, int flag);
diff --git a/lib/Makefile b/lib/Makefile
index 8c5df08..e5a82fc 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,6 +1,5 @@
 obj-y			+= ctype.o
 obj-y			+= rbtree.o
-obj-y			+= display_options.o
 obj-y			+= ldiv.o
 obj-y			+= string.o
 obj-y			+= vsprintf.o
diff --git a/lib/display_options.c b/lib/display_options.c
deleted file mode 100644
index 03f4f22..0000000
--- a/lib/display_options.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * (C) Copyright 2000-2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-
-/*
- * return a pointer to a string containing the size
- * as "xxx kB", "xxx.y kB", "xxx MB" or "xxx.y MB" as needed;
- */
-char *size_human_readable(ulong size)
-{
-	static char buf[20];
-	ulong m, n;
-	ulong d = 1 << 20;		/* 1 MB */
-	char  c = 'M';
-	char *ptr = buf;
-
-	if (size < d) {			/* print in kB */
-		c = 'k';
-		d = 1 << 10;
-	}
-
-	n = size / d;
-
-	m = (10 * (size - (n * d)) + (d / 2) ) / d;
-
-	if (m >= 10) {
-		m -= 10;
-		n += 1;
-	}
-
-	ptr += sprintf(buf, "%2ld", n);
-	if (m) {
-		ptr += sprintf (ptr,".%ld", m);
-	}
-	sprintf(ptr, " %cB", c);
-
-	return buf;
-}
-EXPORT_SYMBOL(size_human_readable);
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-09-02 14:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02 14:10 [PATCH 0/9] preperation for sh adding Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 1/9] types.h: move __kernel_dev_t to include/linux/types.h Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 2/9] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 3/9] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 4/9] arm: move clkdev to drivers/clk Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 5/9] vsprintf: add %w and %w support to print unit Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 15:29   ` Uwe Kleine-König
2010-09-02 15:32     ` Uwe Kleine-König
     [not found]       ` <20100902155421.GB28968@game.jcrosoft.org>
2010-09-02 17:54         ` Uwe Kleine-König
2010-09-02 14:10 ` [PATCH 6/9] at91/clock: switch to %w for clock info printing Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` [PATCH 7/9] cfi_flash: use %W and IEEE 1541 format Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 14:10 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2010-09-02 14:10 ` [PATCH 9/9] clkdev: add print clk info command Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 15:22   ` Uwe Kleine-König
2010-09-02 19:40 ` [PATCH 0/9 V2] preperation for sh adding Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 1/9 V2] types.h: move __kernel_dev_t to include/linux/types.h Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 2/9 V2] device: fix dev_name Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 3/9 V2] stm8815: fix the uart device clock match Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 4/9 V2] arm: move clkdev to drivers/clk Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 5/9 V2] vsprintf: add %w and %w support to print unit Jean-Christophe PLAGNIOL-VILLARD
2010-09-03 18:34     ` Uwe Kleine-König
2010-09-02 19:41   ` [PATCH 6/9 V2] at91/clock: switch to %w for clock info printing Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 7/9 V2] cfi_flash: use %W and IEEE 1541 format Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 8/9 V2] use %W instead of size_human_readable and use " Jean-Christophe PLAGNIOL-VILLARD
2010-09-02 19:41   ` [PATCH 9/9 V2] clkdev: add print clk info command Jean-Christophe PLAGNIOL-VILLARD
2010-09-16 10:38   ` [PATCH 0/9 V2] preperation for sh adding Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283436624-29567-8-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox