mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] devinfo: add human readable size after memory range
@ 2014-05-21 19:43 Franck Jullien
  2014-05-22  6:06 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Franck Jullien @ 2014-05-21 19:43 UTC (permalink / raw)
  To: barebox

It's not always easy to know what is the size of a parition.

This patch adds the size of a memory range in human readable
format. We now have for example:

`---- cfi_flash0
     `---- nor0
          `---- 0x00000000-0x00ffffff (    16 MiB): /dev/nor0
          `---- 0x00000000-0x0001ffff (   128 KiB): /dev/env0
          `---- 0x00020000-0x0011ffff (     1 MiB): /dev/fpga0
          `---- 0x00120000-0x0019ffff (   512 KiB): /dev/self0
          `---- 0x001a0000-0x00d9ffff (    12 MiB): /dev/linux
          `---- 0x00da0000-0x00ffffff (   2.4 MiB): /dev/elf

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 commands/devinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/commands/devinfo.c b/commands/devinfo.c
index 806e45c..75bc9d4 100644
--- a/commands/devinfo.c
+++ b/commands/devinfo.c
@@ -33,9 +33,10 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
 		list_for_each_entry(cdev, &dev->cdevs, devices_list) {
 			for (i = 0; i < depth + 1; i++)
 				printf("     ");
-			printf("`---- 0x%08llx-0x%08llx: /dev/%s\n",
+			printf("`---- 0x%08llx-0x%08llx (%10s): /dev/%s\n",
 					cdev->offset,
 					cdev->offset + cdev->size - 1,
+					size_human_readable(cdev->size),
 					cdev->name);
 		}
 	} else {
-- 
1.7.1


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] devinfo: add human readable size after memory range
  2014-05-21 19:43 [PATCH] devinfo: add human readable size after memory range Franck Jullien
@ 2014-05-22  6:06 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-05-22  6:06 UTC (permalink / raw)
  To: Franck Jullien; +Cc: barebox

On Wed, May 21, 2014 at 09:43:16PM +0200, Franck Jullien wrote:
> It's not always easy to know what is the size of a parition.
> 
> This patch adds the size of a memory range in human readable
> format. We now have for example:
> 
> `---- cfi_flash0
>      `---- nor0
>           `---- 0x00000000-0x00ffffff (    16 MiB): /dev/nor0
>           `---- 0x00000000-0x0001ffff (   128 KiB): /dev/env0
>           `---- 0x00020000-0x0011ffff (     1 MiB): /dev/fpga0
>           `---- 0x00120000-0x0019ffff (   512 KiB): /dev/self0
>           `---- 0x001a0000-0x00d9ffff (    12 MiB): /dev/linux
>           `---- 0x00da0000-0x00ffffff (   2.4 MiB): /dev/elf
> 
> Signed-off-by: Franck Jullien <franck.jullien@gmail.com>

Good idea. Applied, thanks

Sascha

> ---
>  commands/devinfo.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/commands/devinfo.c b/commands/devinfo.c
> index 806e45c..75bc9d4 100644
> --- a/commands/devinfo.c
> +++ b/commands/devinfo.c
> @@ -33,9 +33,10 @@ static int do_devinfo_subtree(struct device_d *dev, int depth)
>  		list_for_each_entry(cdev, &dev->cdevs, devices_list) {
>  			for (i = 0; i < depth + 1; i++)
>  				printf("     ");
> -			printf("`---- 0x%08llx-0x%08llx: /dev/%s\n",
> +			printf("`---- 0x%08llx-0x%08llx (%10s): /dev/%s\n",
>  					cdev->offset,
>  					cdev->offset + cdev->size - 1,
> +					size_human_readable(cdev->size),
>  					cdev->name);
>  		}
>  	} else {
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-22  6:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-21 19:43 [PATCH] devinfo: add human readable size after memory range Franck Jullien
2014-05-22  6:06 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox