* [U-Boot] [PATCH] part: show efi partition name when print out partition info
@ 2011-09-07 11:17 Lei Wen
2011-09-07 11:27 ` Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Lei Wen @ 2011-09-07 11:17 UTC (permalink / raw)
To: u-boot
Previous output:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA
gpt1 0x8C00 0xCBFF
gpt2 0xCC00 0x57BFF
gpt3 0x57C00 0xA2BFF
gpt4 0xA2C00 0xECBFDE
With the patch, the output becomes:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Name Start LBA End LBA
1 ramdisk 0x00008C00 0x0000CBFF
2 system 0x0000CC00 0x00057BFF
3 userdata 0x00057C00 0x000A2BFF
4 remaining 0x000A2C00 0x00ECBFDE
Signed-off-by: Lei Wen <leiwen@marvell.com>
---
disk/part_efi.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 1b04c27..9e2a0dd 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -35,6 +35,7 @@
#include <ide.h>
#include <malloc.h>
#include "part_efi.h"
+#include <linux/ctype.h>
#if defined(CONFIG_CMD_IDE) || \
defined(CONFIG_CMD_MG_DISK) || \
@@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
static int is_pte_valid(gpt_entry * pte);
+static char *print_efiname(gpt_entry *pte)
+{
+ static char name[37];
+ int i;
+ for (i = 0; i < 37; i++) {
+ u8 c;
+ c = pte->partition_name[i] & 0xff;
+ c = (c && !isprint(c)) ? '!' : c;
+ name[i] = c;
+ }
+ name[36] = 0;
+ return name;
+}
+
/*
* Public Functions (include/part.h)
*/
@@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
- printf("Part Start LBA End LBA\n");
+ printf("Part\t\tName\t\tStart LBA\tEnd LBA\n");
for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
if (is_pte_valid(&(*pgpt_pte)[i])) {
- printf("%s%d 0x%llX 0x%llX\n", GPT_ENTRY_NAME,
- (i + 1),
+ printf("%2d\t%18s\t0x%08llX\t0x%08llX\n", (i + 1),
+ print_efiname(&(*pgpt_pte)[i]),
le64_to_int((*pgpt_pte)[i].starting_lba),
le64_to_int((*pgpt_pte)[i].ending_lba));
} else {
@@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
- info->start;
info->blksz = GPT_BLOCK_SIZE;
- sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
+ sprintf((char *)info->name, "%s",
+ print_efiname(&(*pgpt_pte)[part - 1]));
sprintf((char *)info->type, "U-Boot");
debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] part: show efi partition name when print out partition info
2011-09-07 11:17 [U-Boot] [PATCH] part: show efi partition name when print out partition info Lei Wen
@ 2011-09-07 11:27 ` Marek Vasut
2011-09-07 11:29 ` Lei Wen
2011-09-07 13:13 ` [U-Boot] [PATCH V1] " Lei Wen
2011-09-07 19:21 ` [U-Boot] [PATCH] " Wolfgang Denk
2 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2011-09-07 11:27 UTC (permalink / raw)
To: u-boot
On Wednesday, September 07, 2011 01:17:03 PM Lei Wen wrote:
> Previous output:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 -- Partition Type: EFI
>
> Part Start LBA End LBA
> gpt1 0x8C00 0xCBFF
> gpt2 0xCC00 0x57BFF
> gpt3 0x57C00 0xA2BFF
> gpt4 0xA2C00 0xECBFDE
>
> With the patch, the output becomes:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 -- Partition Type: EFI
>
> Part Name Start LBA End LBA
> 1 ramdisk 0x00008C00 0x0000CBFF
> 2 system 0x0000CC00 0x00057BFF
> 3 userdata 0x00057C00 0x000A2BFF
> 4 remaining 0x000A2C00 0x00ECBFDE
>
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
Hi Lei,
what about aligning the Name to the left ?
Cheers
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] part: show efi partition name when print out partition info
2011-09-07 11:27 ` Marek Vasut
@ 2011-09-07 11:29 ` Lei Wen
2011-09-07 12:29 ` Marek Vasut
0 siblings, 1 reply; 14+ messages in thread
From: Lei Wen @ 2011-09-07 11:29 UTC (permalink / raw)
To: u-boot
Hi Marek,
On Wed, Sep 7, 2011 at 7:27 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> On Wednesday, September 07, 2011 01:17:03 PM Lei Wen wrote:
>> Previous output:
>> Marvell>> ?mmc part
>>
>> Partition Map for MMC device 1 ?-- ? Partition Type: EFI
>>
>> Part ?Start LBA ?End LBA
>> gpt1 ?0x8C00 ? ?0xCBFF
>> gpt2 ?0xCC00 ? ?0x57BFF
>> gpt3 ?0x57C00 ? ?0xA2BFF
>> gpt4 ?0xA2C00 ? ?0xECBFDE
>>
>> With the patch, the output becomes:
>> Marvell>> mmc part
>>
>> Partition Map for MMC device 1 ?-- ? Partition Type: EFI
>>
>> Part ? ? ? ? ? ?Name ? ? ? ? ? ?Start LBA ? ? ? End LBA
>> ?1 ? ? ? ? ? ? ? ? ramdisk ? ? ?0x00008C00 ? ? ?0x0000CBFF
>> ?2 ? ? ? ? ? ? ? ? ?system ? ? ?0x0000CC00 ? ? ?0x00057BFF
>> ?3 ? ? ? ? ? ? ? ?userdata ? ? ?0x00057C00 ? ? ?0x000A2BFF
>> ?4 ? ? ? ? ? ? ? remaining ? ? ?0x000A2C00 ? ? ?0x00ECBFDE
>>
>> Signed-off-by: Lei Wen <leiwen@marvell.com>
>> ---
>
> Hi Lei,
>
> what about aligning the Name to the left ?
>
You mean like below?
Name Part Start LBA End LBA
Best regards,
Lei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] part: show efi partition name when print out partition info
2011-09-07 11:29 ` Lei Wen
@ 2011-09-07 12:29 ` Marek Vasut
0 siblings, 0 replies; 14+ messages in thread
From: Marek Vasut @ 2011-09-07 12:29 UTC (permalink / raw)
To: u-boot
On Wednesday, September 07, 2011 01:29:35 PM Lei Wen wrote:
> Hi Marek,
>
> On Wed, Sep 7, 2011 at 7:27 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> > On Wednesday, September 07, 2011 01:17:03 PM Lei Wen wrote:
> >> Previous output:
> >> Marvell>> mmc part
> >>
> >> Partition Map for MMC device 1 -- Partition Type: EFI
> >>
> >> Part Start LBA End LBA
> >> gpt1 0x8C00 0xCBFF
> >> gpt2 0xCC00 0x57BFF
> >> gpt3 0x57C00 0xA2BFF
> >> gpt4 0xA2C00 0xECBFDE
> >>
> >> With the patch, the output becomes:
> >> Marvell>> mmc part
> >>
> >> Partition Map for MMC device 1 -- Partition Type: EFI
> >>
> >> Part Name Start LBA End LBA
> >> 1 ramdisk 0x00008C00 0x0000CBFF
> >> 2 system 0x0000CC00 0x00057BFF
> >> 3 userdata 0x00057C00 0x000A2BFF
> >> 4 remaining 0x000A2C00 0x00ECBFDE
> >>
> >> Signed-off-by: Lei Wen <leiwen@marvell.com>
> >> ---
> >
> > Hi Lei,
> >
> > what about aligning the Name to the left ?
>
> You mean like below?
> Name Part Start LBA End LBA
Like "ramdisk" "system" etc. starting at the same column
>
> Best regards,
> Lei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V1] part: show efi partition name when print out partition info
2011-09-07 11:17 [U-Boot] [PATCH] part: show efi partition name when print out partition info Lei Wen
2011-09-07 11:27 ` Marek Vasut
@ 2011-09-07 13:13 ` Lei Wen
2011-09-07 13:17 ` [U-Boot] [PATCH V2] " Lei Wen
2011-09-07 19:21 ` [U-Boot] [PATCH] " Wolfgang Denk
2 siblings, 1 reply; 14+ messages in thread
From: Lei Wen @ 2011-09-07 13:13 UTC (permalink / raw)
To: u-boot
Previous output:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA
gpt1 0x8C00 0xCBFF
gpt2 0xCC00 0x57BFF
gpt3 0x57C00 0xA2BFF
gpt4 0xA2C00 0xECBFDE
With the patch, the output becomes:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Name Start LBA End LBA
1 ramdisk 0x00008C00 0x0000CBFF
2 system 0x0000CC00 0x00057BFF
3 userdata 0x00057C00 0x000A2BFF
4 remaining 0x000A2C00 0x00ECBFDE
Signed-off-by: Lei Wen <leiwen@marvell.com>
---
Changelog:
V1: align the efi part name output to the left
disk/part_efi.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 1b04c27..49b7f35 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -35,6 +35,7 @@
#include <ide.h>
#include <malloc.h>
#include "part_efi.h"
+#include <linux/ctype.h>
#if defined(CONFIG_CMD_IDE) || \
defined(CONFIG_CMD_MG_DISK) || \
@@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
static int is_pte_valid(gpt_entry * pte);
+static char *print_efiname(gpt_entry *pte)
+{
+ static char name[37];
+ int i;
+ for (i = 0; i < 37; i++) {
+ u8 c;
+ c = pte->partition_name[i] & 0xff;
+ c = (c && !isprint(c)) ? '!' : c;
+ name[i] = c;
+ }
+ name[36] = 0;
+ return name;
+}
+
/*
* Public Functions (include/part.h)
*/
@@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
- printf("Part Start LBA End LBA\n");
+ printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
if (is_pte_valid(&(*pgpt_pte)[i])) {
- printf("%s%d 0x%llX 0x%llX\n", GPT_ENTRY_NAME,
- (i + 1),
+ printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
+ print_efiname(&(*pgpt_pte)[i]),
le64_to_int((*pgpt_pte)[i].starting_lba),
le64_to_int((*pgpt_pte)[i].ending_lba));
} else {
@@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
- info->start;
info->blksz = GPT_BLOCK_SIZE;
- sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
+ sprintf((char *)info->name, "%s",
+ print_efiname(&(*pgpt_pte)[part - 1]));
sprintf((char *)info->type, "U-Boot");
debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V2] part: show efi partition name when print out partition info
2011-09-07 13:13 ` [U-Boot] [PATCH V1] " Lei Wen
@ 2011-09-07 13:17 ` Lei Wen
2011-09-07 19:23 ` Wolfgang Denk
0 siblings, 1 reply; 14+ messages in thread
From: Lei Wen @ 2011-09-07 13:17 UTC (permalink / raw)
To: u-boot
Previous output:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA
gpt1 0x8C00 0xCBFF
gpt2 0xCC00 0x57BFF
gpt3 0x57C00 0xA2BFF
gpt4 0xA2C00 0xECBFDE
With the patch, the output becomes:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Name Start LBA End LBA
1 ramdisk 0x00008C00 0x0000CBFF
2 system 0x0000CC00 0x00057BFF
3 userdata 0x00057C00 0x000A2BFF
4 remaining 0x000A2C00 0x00ECBFDE
Signed-off-by: Lei Wen <leiwen@marvell.com>
---
Changelog:
V1: align the efi part name output to the left
V2: correct patch description for this new alignment
disk/part_efi.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 1b04c27..49b7f35 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -35,6 +35,7 @@
#include <ide.h>
#include <malloc.h>
#include "part_efi.h"
+#include <linux/ctype.h>
#if defined(CONFIG_CMD_IDE) || \
defined(CONFIG_CMD_MG_DISK) || \
@@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
static int is_pte_valid(gpt_entry * pte);
+static char *print_efiname(gpt_entry *pte)
+{
+ static char name[37];
+ int i;
+ for (i = 0; i < 37; i++) {
+ u8 c;
+ c = pte->partition_name[i] & 0xff;
+ c = (c && !isprint(c)) ? '!' : c;
+ name[i] = c;
+ }
+ name[36] = 0;
+ return name;
+}
+
/*
* Public Functions (include/part.h)
*/
@@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
- printf("Part Start LBA End LBA\n");
+ printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
if (is_pte_valid(&(*pgpt_pte)[i])) {
- printf("%s%d 0x%llX 0x%llX\n", GPT_ENTRY_NAME,
- (i + 1),
+ printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
+ print_efiname(&(*pgpt_pte)[i]),
le64_to_int((*pgpt_pte)[i].starting_lba),
le64_to_int((*pgpt_pte)[i].ending_lba));
} else {
@@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
- info->start;
info->blksz = GPT_BLOCK_SIZE;
- sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
+ sprintf((char *)info->name, "%s",
+ print_efiname(&(*pgpt_pte)[part - 1]));
sprintf((char *)info->type, "U-Boot");
debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] part: show efi partition name when print out partition info
2011-09-07 11:17 [U-Boot] [PATCH] part: show efi partition name when print out partition info Lei Wen
2011-09-07 11:27 ` Marek Vasut
2011-09-07 13:13 ` [U-Boot] [PATCH V1] " Lei Wen
@ 2011-09-07 19:21 ` Wolfgang Denk
2011-09-08 4:11 ` [U-Boot] [PATCH V3] " Lei Wen
2 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Denk @ 2011-09-07 19:21 UTC (permalink / raw)
To: u-boot
Dear Lei Wen,
In message <1315394223-12399-1-git-send-email-leiwen@marvell.com> you wrote:
...
> +static char *print_efiname(gpt_entry *pte)
> +{
> + static char name[37];
I hate these magic constants where nobody knows where they are coming
from. Please use the size of the partition_name[] array for reference
instead.
> + int i;
> + for (i = 0; i < 37; i++) {
Again, drop this magic constant. Also note that 37 is actually wrong
here - you are accessing an element beyond the end of partition_name[]
> + u8 c;
> + c = pte->partition_name[i] & 0xff;
> + c = (c && !isprint(c)) ? '!' : c;
Why do you use '!' to mark nonprinting characters? Most memory dump
tools atc. use '.' instead.
> + name[i] = c;
> + }
> + name[36] = 0;
And again: get rid of this constant.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The thing is, as you progress in the Craft, you'll learn there is
another rule... When you break rules, break 'em good and hard.
- Terry Pratchett, _Wyrd Sisters_
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V2] part: show efi partition name when print out partition info
2011-09-07 13:17 ` [U-Boot] [PATCH V2] " Lei Wen
@ 2011-09-07 19:23 ` Wolfgang Denk
0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2011-09-07 19:23 UTC (permalink / raw)
To: u-boot
Dear Lei Wen,
In message <1315401458-19779-1-git-send-email-leiwen@marvell.com> you wrote:
> Previous output:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 -- Partition Type: EFI
My previous comments still apply.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Don't tell me how hard you work. Tell me how much you get done.
-- James J. Ling
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-07 19:21 ` [U-Boot] [PATCH] " Wolfgang Denk
@ 2011-09-08 4:11 ` Lei Wen
2011-09-29 2:14 ` Lei Wen
2011-10-06 18:42 ` Wolfgang Denk
0 siblings, 2 replies; 14+ messages in thread
From: Lei Wen @ 2011-09-08 4:11 UTC (permalink / raw)
To: u-boot
Previous output:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Start LBA End LBA
gpt1 0x8C00 0xCBFF
gpt2 0xCC00 0x57BFF
gpt3 0x57C00 0xA2BFF
gpt4 0xA2C00 0xECBFDE
With the patch, the output becomes:
Marvell>> mmc part
Partition Map for MMC device 1 -- Partition Type: EFI
Part Name Start LBA End LBA
1 ramdisk 0x00008C00 0x0000CBFF
2 system 0x0000CC00 0x00057BFF
3 userdata 0x00057C00 0x000A2BFF
4 remaining 0x000A2C00 0x00ECBFDE
Signed-off-by: Lei Wen <leiwen@marvell.com>
---
Changelog:
V1: align the efi part name output to the left
V2: correct patch description for this new alignment
V3: Remove the magic number definition, and reuse the same
number used by partition_name. Fix loop overflow issue.
disk/part_efi.c | 24 ++++++++++++++++++++----
disk/part_efi.h | 3 ++-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 1b04c27..0a513c6 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -35,6 +35,7 @@
#include <ide.h>
#include <malloc.h>
#include "part_efi.h"
+#include <linux/ctype.h>
#if defined(CONFIG_CMD_IDE) || \
defined(CONFIG_CMD_MG_DISK) || \
@@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
static int is_pte_valid(gpt_entry * pte);
+static char *print_efiname(gpt_entry *pte)
+{
+ static char name[PARTNAME_SZ + 1];
+ int i;
+ for (i = 0; i < PARTNAME_SZ; i++) {
+ u8 c;
+ c = pte->partition_name[i] & 0xff;
+ c = (c && !isprint(c)) ? '.' : c;
+ name[i] = c;
+ }
+ name[PARTNAME_SZ] = 0;
+ return name;
+}
+
/*
* Public Functions (include/part.h)
*/
@@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
- printf("Part Start LBA End LBA\n");
+ printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
if (is_pte_valid(&(*pgpt_pte)[i])) {
- printf("%s%d 0x%llX 0x%llX\n", GPT_ENTRY_NAME,
- (i + 1),
+ printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
+ print_efiname(&(*pgpt_pte)[i]),
le64_to_int((*pgpt_pte)[i].starting_lba),
le64_to_int((*pgpt_pte)[i].ending_lba));
} else {
@@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
- info->start;
info->blksz = GPT_BLOCK_SIZE;
- sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
+ sprintf((char *)info->name, "%s",
+ print_efiname(&(*pgpt_pte)[part - 1]));
sprintf((char *)info->type, "U-Boot");
debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
diff --git a/disk/part_efi.h b/disk/part_efi.h
index 6bbb06b..5903e7c 100644
--- a/disk/part_efi.h
+++ b/disk/part_efi.h
@@ -117,13 +117,14 @@ typedef struct _gpt_entry_attributes {
unsigned long long type_guid_specific:16;
} __attribute__ ((packed)) gpt_entry_attributes;
+#define PARTNAME_SZ (72 / sizeof(efi_char16_t))
typedef struct _gpt_entry {
efi_guid_t partition_type_guid;
efi_guid_t unique_partition_guid;
unsigned char starting_lba[8];
unsigned char ending_lba[8];
gpt_entry_attributes attributes;
- efi_char16_t partition_name[72 / sizeof(efi_char16_t)];
+ efi_char16_t partition_name[PARTNAME_SZ];
}
__attribute__ ((packed)) gpt_entry;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-08 4:11 ` [U-Boot] [PATCH V3] " Lei Wen
@ 2011-09-29 2:14 ` Lei Wen
2011-09-29 16:16 ` Marek Vasut
2011-10-06 18:42 ` Wolfgang Denk
1 sibling, 1 reply; 14+ messages in thread
From: Lei Wen @ 2011-09-29 2:14 UTC (permalink / raw)
To: u-boot
Hi Wolfgang,
On Thu, Sep 8, 2011 at 12:11 PM, Lei Wen <leiwen@marvell.com> wrote:
> Previous output:
> Marvell>> ?mmc part
>
> Partition Map for MMC device 1 ?-- ? Partition Type: EFI
>
> Part ?Start LBA ?End LBA
> gpt1 ?0x8C00 ? ?0xCBFF
> gpt2 ?0xCC00 ? ?0x57BFF
> gpt3 ?0x57C00 ? ?0xA2BFF
> gpt4 ?0xA2C00 ? ?0xECBFDE
>
> With the patch, the output becomes:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 ?-- ? Partition Type: EFI
>
> Part ? ?Name ? ? ? ? ? ? ? ? ? ?Start LBA ? ? ? End LBA
> ?1 ? ? ramdisk ? ? ? ? ? ? ? ? 0x00008C00 ? ? ?0x0000CBFF
> ?2 ? ? system ? ? ? ? ? ? ? ? ?0x0000CC00 ? ? ?0x00057BFF
> ?3 ? ? userdata ? ? ? ? ? ? ? ?0x00057C00 ? ? ?0x000A2BFF
> ?4 ? ? remaining ? ? ? ? ? ? ? 0x000A2C00 ? ? ?0x00ECBFDE
>
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
> Changelog:
> V1: align the efi part name output to the left
> V2: correct patch description for this new alignment
> V3: Remove the magic number definition, and reuse the same
> ? ?number used by partition_name. Fix loop overflow issue.
>
> ?disk/part_efi.c | ? 24 ++++++++++++++++++++----
> ?disk/part_efi.h | ? ?3 ++-
> ?2 files changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/disk/part_efi.c b/disk/part_efi.c
> index 1b04c27..0a513c6 100644
> --- a/disk/part_efi.c
> +++ b/disk/part_efi.c
> @@ -35,6 +35,7 @@
> ?#include <ide.h>
> ?#include <malloc.h>
> ?#include "part_efi.h"
> +#include <linux/ctype.h>
>
> ?#if defined(CONFIG_CMD_IDE) || \
> ? ? defined(CONFIG_CMD_MG_DISK) || \
> @@ -99,6 +100,20 @@ static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc,
>
> ?static int is_pte_valid(gpt_entry * pte);
>
> +static char *print_efiname(gpt_entry *pte)
> +{
> + ? ? ? static char name[PARTNAME_SZ + 1];
> + ? ? ? int i;
> + ? ? ? for (i = 0; i < PARTNAME_SZ; i++) {
> + ? ? ? ? ? ? ? u8 c;
> + ? ? ? ? ? ? ? c = pte->partition_name[i] & 0xff;
> + ? ? ? ? ? ? ? c = (c && !isprint(c)) ? '.' : c;
> + ? ? ? ? ? ? ? name[i] = c;
> + ? ? ? }
> + ? ? ? name[PARTNAME_SZ] = 0;
> + ? ? ? return name;
> +}
> +
> ?/*
> ?* Public Functions (include/part.h)
> ?*/
> @@ -122,12 +137,12 @@ void print_part_efi(block_dev_desc_t * dev_desc)
>
> ? ? ? ?debug("%s: gpt-entry at 0x%08X\n", __FUNCTION__, (unsigned int)*pgpt_pte);
>
> - ? ? ? printf("Part ?Start LBA ?End LBA\n");
> + ? ? ? printf("Part\tName\t\t\tStart LBA\tEnd LBA\n");
> ? ? ? ?for (i = 0; i < le32_to_int(gpt_head.num_partition_entries); i++) {
>
> ? ? ? ? ? ? ? ?if (is_pte_valid(&(*pgpt_pte)[i])) {
> - ? ? ? ? ? ? ? ? ? ? ? printf("%s%d ?0x%llX ? ?0x%llX\n", GPT_ENTRY_NAME,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (i + 1),
> + ? ? ? ? ? ? ? ? ? ? ? printf("%3d\t%-18s\t0x%08llX\t0x%08llX\n", (i + 1),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? print_efiname(&(*pgpt_pte)[i]),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?le64_to_int((*pgpt_pte)[i].starting_lba),
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?le64_to_int((*pgpt_pte)[i].ending_lba));
> ? ? ? ? ? ? ? ?} else {
> @@ -169,7 +184,8 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
> ? ? ? ? ? ? ? ? ? ? - info->start;
> ? ? ? ?info->blksz = GPT_BLOCK_SIZE;
>
> - ? ? ? sprintf((char *)info->name, "%s%d", GPT_ENTRY_NAME, part);
> + ? ? ? sprintf((char *)info->name, "%s",
> + ? ? ? ? ? ? ? ? ? ? ? print_efiname(&(*pgpt_pte)[part - 1]));
> ? ? ? ?sprintf((char *)info->type, "U-Boot");
>
> ? ? ? ?debug("%s: start 0x%lX, size 0x%lX, name %s", __FUNCTION__,
> diff --git a/disk/part_efi.h b/disk/part_efi.h
> index 6bbb06b..5903e7c 100644
> --- a/disk/part_efi.h
> +++ b/disk/part_efi.h
> @@ -117,13 +117,14 @@ typedef struct _gpt_entry_attributes {
> ? ? ? ?unsigned long long type_guid_specific:16;
> ?} __attribute__ ((packed)) gpt_entry_attributes;
>
> +#define PARTNAME_SZ ? ?(72 / sizeof(efi_char16_t))
> ?typedef struct _gpt_entry {
> ? ? ? ?efi_guid_t partition_type_guid;
> ? ? ? ?efi_guid_t unique_partition_guid;
> ? ? ? ?unsigned char starting_lba[8];
> ? ? ? ?unsigned char ending_lba[8];
> ? ? ? ?gpt_entry_attributes attributes;
> - ? ? ? efi_char16_t partition_name[72 / sizeof(efi_char16_t)];
> + ? ? ? efi_char16_t partition_name[PARTNAME_SZ];
> ?}
> ?__attribute__ ((packed)) gpt_entry;
>
> --
> 1.7.0.4
>
How about merge this patch included in 2011.09 release? :)
Thanks,
Lei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-29 2:14 ` Lei Wen
@ 2011-09-29 16:16 ` Marek Vasut
2011-09-30 1:45 ` Lei Wen
0 siblings, 1 reply; 14+ messages in thread
From: Marek Vasut @ 2011-09-29 16:16 UTC (permalink / raw)
To: u-boot
On Thursday, September 29, 2011 04:14:40 AM Lei Wen wrote:
> Hi Wolfgang,
>
> On Thu, Sep 8, 2011 at 12:11 PM, Lei Wen <leiwen@marvell.com> wrote:
> > Previous output:
[...]
>
> How about merge this patch included in 2011.09 release? :)
>
> Thanks,
> Lei
Hi Lei,
I can't speak for Wolfgang, but I think we're pretty late in rc2 now.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-29 16:16 ` Marek Vasut
@ 2011-09-30 1:45 ` Lei Wen
2011-10-05 2:07 ` Lei Wen
0 siblings, 1 reply; 14+ messages in thread
From: Lei Wen @ 2011-09-30 1:45 UTC (permalink / raw)
To: u-boot
On Fri, Sep 30, 2011 at 12:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
> On Thursday, September 29, 2011 04:14:40 AM Lei Wen wrote:
>> Hi Wolfgang,
>>
>> On Thu, Sep 8, 2011 at 12:11 PM, Lei Wen <leiwen@marvell.com> wrote:
>> > Previous output:
>
> [...]
>
>>
>> How about merge this patch included in 2011.09 release? :)
>>
>> Thanks,
>> Lei
>
> Hi Lei,
>
> I can't speak for Wolfgang, but I think we're pretty late in rc2 now.
Em... I understand...
How about queue this patch for the next v2011.12 release?
I just don't know how the patches is managed in uboot now. The
patchwork also cannot get enough info for this.
Thanks,
Lei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-30 1:45 ` Lei Wen
@ 2011-10-05 2:07 ` Lei Wen
0 siblings, 0 replies; 14+ messages in thread
From: Lei Wen @ 2011-10-05 2:07 UTC (permalink / raw)
To: u-boot
Hi,
On Fri, Sep 30, 2011 at 9:45 AM, Lei Wen <adrian.wenl@gmail.com> wrote:
> On Fri, Sep 30, 2011 at 12:16 AM, Marek Vasut <marek.vasut@gmail.com> wrote:
>> On Thursday, September 29, 2011 04:14:40 AM Lei Wen wrote:
>>> Hi Wolfgang,
>>>
>>> On Thu, Sep 8, 2011 at 12:11 PM, Lei Wen <leiwen@marvell.com> wrote:
>>> > Previous output:
>>
>> [...]
>>
>>>
>>> How about merge this patch included in 2011.09 release? :)
>>>
>>> Thanks,
>>> Lei
>>
>> Hi Lei,
>>
>> I can't speak for Wolfgang, but I think we're pretty late in rc2 now.
>
> Em... I understand...
> How about queue this patch for the next v2011.12 release?
> I just don't know how the patches is managed in uboot now. The
> patchwork also cannot get enough info for this.
>
Any feedback to this?...
Thanks,
Lei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH V3] part: show efi partition name when print out partition info
2011-09-08 4:11 ` [U-Boot] [PATCH V3] " Lei Wen
2011-09-29 2:14 ` Lei Wen
@ 2011-10-06 18:42 ` Wolfgang Denk
1 sibling, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2011-10-06 18:42 UTC (permalink / raw)
To: u-boot
Dear Lei Wen,
In message <1315455079-13051-1-git-send-email-leiwen@marvell.com> you wrote:
> Previous output:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 -- Partition Type: EFI
>
> Part Start LBA End LBA
> gpt1 0x8C00 0xCBFF
> gpt2 0xCC00 0x57BFF
> gpt3 0x57C00 0xA2BFF
> gpt4 0xA2C00 0xECBFDE
>
> With the patch, the output becomes:
> Marvell>> mmc part
>
> Partition Map for MMC device 1 -- Partition Type: EFI
>
> Part Name Start LBA End LBA
> 1 ramdisk 0x00008C00 0x0000CBFF
> 2 system 0x0000CC00 0x00057BFF
> 3 userdata 0x00057C00 0x000A2BFF
> 4 remaining 0x000A2C00 0x00ECBFDE
>
> Signed-off-by: Lei Wen <leiwen@marvell.com>
> ---
> Changelog:
> V1: align the efi part name output to the left
> V2: correct patch description for this new alignment
> V3: Remove the magic number definition, and reuse the same
> number used by partition_name. Fix loop overflow issue.
>
> disk/part_efi.c | 24 ++++++++++++++++++++----
> disk/part_efi.h | 3 ++-
> 2 files changed, 22 insertions(+), 5 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
That said, there may be good reasons for what you did beyond obsequi-
ous sycophantic parody. Perhaps you might be so kind as to elucidate.
-- Tom Christiansen in <5ldjbm$jtk$1@csnews.cs.colorado.edu>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2011-10-06 18:42 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07 11:17 [U-Boot] [PATCH] part: show efi partition name when print out partition info Lei Wen
2011-09-07 11:27 ` Marek Vasut
2011-09-07 11:29 ` Lei Wen
2011-09-07 12:29 ` Marek Vasut
2011-09-07 13:13 ` [U-Boot] [PATCH V1] " Lei Wen
2011-09-07 13:17 ` [U-Boot] [PATCH V2] " Lei Wen
2011-09-07 19:23 ` Wolfgang Denk
2011-09-07 19:21 ` [U-Boot] [PATCH] " Wolfgang Denk
2011-09-08 4:11 ` [U-Boot] [PATCH V3] " Lei Wen
2011-09-29 2:14 ` Lei Wen
2011-09-29 16:16 ` Marek Vasut
2011-09-30 1:45 ` Lei Wen
2011-10-05 2:07 ` Lei Wen
2011-10-06 18:42 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.