Skip to contentSkip to conversation

part: show efi partition name when print out partition info

PATCH New Lei Wen 4 participants 14 messages Sep 7, 2011 – Oct 6, 2011

lore
Share & tools
lore

Lei Wen

author
#0 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

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
---
 disk/part_efi.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
disk/part_efi.c +20 -4
index 1b04c27..9e2a0dd 100644
@@ -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__,
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

Quoted 16 lines · Lei Wen

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

Quoted 8 lines
Part            Name            Start LBA       End LBA
 1                 ramdisk      0x00008C00      0x0000CBFF
 2                  system      0x0000CC00      0x00057BFF
 3                userdata      0x00057C00      0x000A2BFF
 4               remaining      0x000A2C00      0x00ECBFDE

---

Hi Lei,

what about aligning the Name to the left ?

Cheers

#2 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

Hi Marek,

Quoted 23 lines · Marek Vasut
Quoted 22 lines · Lei Wen

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

Quoted 7 lines
Quoted 2 lines

---

Hi Lei,

what about aligning the Name to the left ?

You mean like below?
Name Part Start LBA End LBA

Best regards,
Lei

#3 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

Quoted 29 lines · Lei Wen

Hi Marek,

Quoted 26 lines · Marek Vasut
Quoted 24 lines · Lei Wen

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

---

Quoted 6 lines
Quoted 3 lines

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

Quoted 3 lines

Best regards,
Lei

author
#4 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

In reply to Lei Wen

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

---
Changelog:
V1: align the efi part name output to the left

 disk/part_efi.c |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
disk/part_efi.c +20 -4
index 1b04c27..49b7f35 100644
@@ -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__,
Signature · 1 line
1.7.0.4
author
#5 lore raw

PATCH v2 1/1 part: show efi partition name when print out partition info

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

---
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(-)
disk/part_efi.c +20 -4
index 1b04c27..49b7f35 100644
@@ -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__,
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v2 1/1 part: show efi partition name when print out partition info

Dear Lei Wen,

Quoted 4 lines · In message <[email protected]> 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

Signature · 5 lines
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
#7 lore raw

PATCH 1/1 part: show efi partition name when print out partition info

In reply to Lei Wen

Dear Lei Wen,

In message <[email protected]> you wrote:
...

disk/part_efi.c static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc, · line 105

Quoted 3 lines
disk/part_efi.c +3 -0
+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.

disk/part_efi.c static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc, · line 107

Quoted 2 lines
disk/part_efi.c +2 -0
+	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[]

disk/part_efi.c static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc, · line 110

Quoted 3 lines
disk/part_efi.c +3 -0
+		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.

disk/part_efi.c static gpt_entry *alloc_read_gpt_entries(block_dev_desc_t * dev_desc, · line 113

Quoted 3 lines
disk/part_efi.c +3 -0
+		name[i] = c;
+	}
+	name[36] = 0;

And again: get rid of this constant.

Best regards,

Wolfgang Denk

Signature · 6 lines
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_
author
#8 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

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

---
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(-)
disk/part_efi.c +20 -4
index 1b04c27..0a513c6 100644
@@ -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__,
disk/part_efi.h +2 -1
index 6bbb06b..5903e7c 100644
@@ -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;
 
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

Hi Wolfgang,

Quoted 114 lines · Lei Wen

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

---
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(-)

disk/part_efi.c +0 -0
index 1b04c27..0a513c6 100644
@@ -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) || \

disk/part_efi.c +14 -0
@@ -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)
?*/

disk/part_efi.c +5 -4
@@ -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__,
disk/part_efi.h +2 -2
index 6bbb06b..5903e7c 100644
@@ -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;
 
--
Quoted 2 lines

1.7.0.4

How about merge this patch included in 2011.09 release? :)

Thanks,
Lei

#10 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

Quoted 4 lines · Lei Wen

Hi Wolfgang,

Quoted 1 line · Lei Wen

Previous output:

[...]

Quoted 5 lines

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.

#11 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

Quoted 9 lines · Marek Vasut
Quoted 4 lines · Lei Wen

Hi Wolfgang,

Quoted 1 line · Lei Wen

Previous output:

[...]

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

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

#12 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

Hi,

Quoted 15 lines · Lei Wen
Quoted 14 lines · Marek Vasut
Quoted 4 lines · Lei Wen

Hi Wolfgang,

Quoted 1 line · Lei Wen

Previous output:

[...]

Quoted 5 lines

How about merge this patch included in 2011.09 release? :)

Thanks,
Lei

Quoted 9 lines
Quoted 3 lines

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

#13 lore raw

PATCH v3 1/1 part: show efi partition name when print out partition info

In reply to Lei Wen

Dear Lei Wen,

Quoted 30 lines · In message <[email protected]> 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

---
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.

Quoted 3 lines
 disk/part_efi.c |   24 ++++++++++++++++++++----
 disk/part_efi.h |    3 ++-
 2 files changed, 22 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
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 <[email protected]>