diff mbox

[U-Boot,v2,6/6] GPT: fix error in partitions string doc

Message ID 1496076573-14495-7-git-send-email-alison@peloton-tech.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Alison Chaiken May 29, 2017, 4:49 p.m. UTC
From: Alison Chaiken <alison@she-devel.com>

The existing partitions-list parsing in cmd/gpt.c passes a value
from gpt_default() to set_gpt_info() that README.gpt suggests
should begin with 'partitions='.  Partition-list strings should
in fact begin with 'uuid_disk', as otherwise the call from
set_gpt_info() to extract_val() to find 'uuid_disk' will fail.
Change README.gpt and file comments accordingly.

Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
---
 cmd/gpt.c      | 13 +------------
 doc/README.gpt |  8 ++++----
 2 files changed, 5 insertions(+), 16 deletions(-)

Comments

Lukasz Majewski May 31, 2017, 8:14 a.m. UTC | #1
Hi Alison,

> From: Alison Chaiken <alison@she-devel.com>
> 
> The existing partitions-list parsing in cmd/gpt.c passes a value
> from gpt_default() to set_gpt_info() that README.gpt suggests
> should begin with 'partitions='.  Partition-list strings should
> in fact begin with 'uuid_disk', as otherwise the call from
> set_gpt_info() to extract_val() to find 'uuid_disk' will fail.
> Change README.gpt and file comments accordingly.

Acked-by: Lukasz Majewski <lukma@denx.de>

Thank you for updating the README.gpt entry.

> 
> Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
> ---
>  cmd/gpt.c      | 13 +------------
>  doc/README.gpt |  8 ++++----
>  2 files changed, 5 insertions(+), 16 deletions(-)
> 
> diff --git a/cmd/gpt.c b/cmd/gpt.c
> index 6a0b70f..487314b 100644
> --- a/cmd/gpt.c
> +++ b/cmd/gpt.c
> @@ -232,12 +232,6 @@ static void print_gpt_info(void)
>  #ifdef CONFIG_CMD_GPT_FLIP
>  static int calc_parts_list_len(int numparts)
>  {
> -	/*
> -	 * prefatory string:
> -	 * doc/README.GPT, suggests that
> -	 * int partlistlen = UUID_STR_LEN + 1 +
> strlen("partitions=uuid_disk=");
> -	 * is correct, but extract_val() expects "uuid_disk" first.
> -	 */
>  	int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
>  	/* for the comma */
>  	partlistlen++;
> @@ -260,7 +254,7 @@ static int calc_parts_list_len(int numparts)
>   * argument
>   *
>   * From doc/README.gpt, Format of partitions layout:
> - *    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> + *    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
>   *	name=kernel,size=60MiB,uuid=...;"
>   * The fields 'name' and 'size' are mandatory for every partition.
>   * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
> @@ -275,11 +269,6 @@ static int create_gpt_partitions_list(int
> numparts, const char *guid, char *part if (!partitions_list)
>  		return -1;
>  
> -	/*
> -	 * README.gpt specifies starting with "partitions=" like so:
> -	 *      strcpy(partitions_list, "partitions=uuid_disk=");
> -	 * but that breaks extract_val, which doesn't skip over
> 'partitions='.
> -	 */
>  	strcpy(partitions_list, "uuid_disk=");
>  	strncat(partitions_list, guid, UUID_STR_LEN + 1);
>  	strcat(partitions_list, ";");
> diff --git a/doc/README.gpt b/doc/README.gpt
> index e29b188..754e490 100644
> --- a/doc/README.gpt
> +++ b/doc/README.gpt
> @@ -156,10 +156,10 @@ Creating GPT partitions in U-Boot:
>  To restore GUID partition table one needs to:
>  1. Define partition layout in the environment.
>     Format of partitions layout:
> -     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> +     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
>  	name=kernel,size=60MiB,uuid=...;"
>       or
> -     "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
> +     "uuid_disk=${uuid_gpt_disk};name=${uboot_name},
>  	size=${uboot_size},uuid=${uboot_uuid};"
>  
>     The fields 'name' and 'size' are mandatory for every partition.
> @@ -233,7 +233,7 @@ PARTITION_BASIC_DATA_GUID
> (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7). If you define
> 'CONFIG_PARTITION_TYPE_GUID', a optionnal parameter 'type' can
> specify a other partition type guid: 
> -     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> +     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
>  	name=kernel,size=60MiB,uuid=...,
>  	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"
>  
> @@ -255,7 +255,7 @@ Some strings can be also used at the place of
> known GUID : "lvm"    = PARTITION_LINUX_LVM_GUID
>  	           (E6D6D379-F507-44C2-A23C-238F2A3DF928)
>  
> -    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> +    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
>  	name=kernel,size=60MiB,uuid=...,type=linux;"
>  
>  They are also used to display the type of partition in "part list"
> command.




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Lukasz Majewski May 31, 2017, 11:21 a.m. UTC | #2
Hi Alison,

> Hi Alison,
> 
> > From: Alison Chaiken <alison@she-devel.com>
> > 
> > The existing partitions-list parsing in cmd/gpt.c passes a value
> > from gpt_default() to set_gpt_info() that README.gpt suggests
> > should begin with 'partitions='.  Partition-list strings should
> > in fact begin with 'uuid_disk', as otherwise the call from
> > set_gpt_info() to extract_val() to find 'uuid_disk' will fail.
> > Change README.gpt and file comments accordingly.
> 
> Acked-by: Lukasz Majewski <lukma@denx.de>
> 
> Thank you for updating the README.gpt entry.

Please also use either patman or get_maintainer before sending the
patchset.

For exmaple:
./scripts/get_maintainer.pl 0001-wip.patch

In that way all relevant people would be informed :-)

> 
> > 
> > Signed-off-by: Alison Chaiken <alison@peloton-tech.com>
> > ---
> >  cmd/gpt.c      | 13 +------------
> >  doc/README.gpt |  8 ++++----
> >  2 files changed, 5 insertions(+), 16 deletions(-)
> > 
> > diff --git a/cmd/gpt.c b/cmd/gpt.c
> > index 6a0b70f..487314b 100644
> > --- a/cmd/gpt.c
> > +++ b/cmd/gpt.c
> > @@ -232,12 +232,6 @@ static void print_gpt_info(void)
> >  #ifdef CONFIG_CMD_GPT_FLIP
> >  static int calc_parts_list_len(int numparts)
> >  {
> > -	/*
> > -	 * prefatory string:
> > -	 * doc/README.GPT, suggests that
> > -	 * int partlistlen = UUID_STR_LEN + 1 +
> > strlen("partitions=uuid_disk=");
> > -	 * is correct, but extract_val() expects "uuid_disk" first.
> > -	 */
> >  	int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
> >  	/* for the comma */
> >  	partlistlen++;
> > @@ -260,7 +254,7 @@ static int calc_parts_list_len(int numparts)
> >   * argument
> >   *
> >   * From doc/README.gpt, Format of partitions layout:
> > - *    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> > + *    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> >   *	name=kernel,size=60MiB,uuid=...;"
> >   * The fields 'name' and 'size' are mandatory for every partition.
> >   * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
> > @@ -275,11 +269,6 @@ static int create_gpt_partitions_list(int
> > numparts, const char *guid, char *part if (!partitions_list)
> >  		return -1;
> >  
> > -	/*
> > -	 * README.gpt specifies starting with "partitions=" like
> > so:
> > -	 *      strcpy(partitions_list, "partitions=uuid_disk=");
> > -	 * but that breaks extract_val, which doesn't skip over
> > 'partitions='.
> > -	 */
> >  	strcpy(partitions_list, "uuid_disk=");
> >  	strncat(partitions_list, guid, UUID_STR_LEN + 1);
> >  	strcat(partitions_list, ";");
> > diff --git a/doc/README.gpt b/doc/README.gpt
> > index e29b188..754e490 100644
> > --- a/doc/README.gpt
> > +++ b/doc/README.gpt
> > @@ -156,10 +156,10 @@ Creating GPT partitions in U-Boot:
> >  To restore GUID partition table one needs to:
> >  1. Define partition layout in the environment.
> >     Format of partitions layout:
> > -     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> > +     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> >  	name=kernel,size=60MiB,uuid=...;"
> >       or
> > -     "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
> > +     "uuid_disk=${uuid_gpt_disk};name=${uboot_name},
> >  	size=${uboot_size},uuid=${uboot_uuid};"
> >  
> >     The fields 'name' and 'size' are mandatory for every partition.
> > @@ -233,7 +233,7 @@ PARTITION_BASIC_DATA_GUID
> > (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7). If you define
> > 'CONFIG_PARTITION_TYPE_GUID', a optionnal parameter 'type' can
> > specify a other partition type guid: 
> > -     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> > +     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> >  	name=kernel,size=60MiB,uuid=...,
> >  	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"
> >  
> > @@ -255,7 +255,7 @@ Some strings can be also used at the place of
> > known GUID : "lvm"    = PARTITION_LINUX_LVM_GUID
> >  	           (E6D6D379-F507-44C2-A23C-238F2A3DF928)
> >  
> > -    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> > +    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
> >  	name=kernel,size=60MiB,uuid=...,type=linux;"
> >  
> >  They are also used to display the type of partition in "part list"
> > command.
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
diff mbox

Patch

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 6a0b70f..487314b 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -232,12 +232,6 @@  static void print_gpt_info(void)
 #ifdef CONFIG_CMD_GPT_FLIP
 static int calc_parts_list_len(int numparts)
 {
-	/*
-	 * prefatory string:
-	 * doc/README.GPT, suggests that
-	 * int partlistlen = UUID_STR_LEN + 1 + strlen("partitions=uuid_disk=");
-	 * is correct, but extract_val() expects "uuid_disk" first.
-	 */
 	int partlistlen = UUID_STR_LEN + 1 + strlen("uuid_disk=");
 	/* for the comma */
 	partlistlen++;
@@ -260,7 +254,7 @@  static int calc_parts_list_len(int numparts)
  * argument
  *
  * From doc/README.gpt, Format of partitions layout:
- *    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+ *    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
  *	name=kernel,size=60MiB,uuid=...;"
  * The fields 'name' and 'size' are mandatory for every partition.
  * The field 'start' is optional. The fields 'uuid' and 'uuid_disk'
@@ -275,11 +269,6 @@  static int create_gpt_partitions_list(int numparts, const char *guid, char *part
 	if (!partitions_list)
 		return -1;
 
-	/*
-	 * README.gpt specifies starting with "partitions=" like so:
-	 *      strcpy(partitions_list, "partitions=uuid_disk=");
-	 * but that breaks extract_val, which doesn't skip over 'partitions='.
-	 */
 	strcpy(partitions_list, "uuid_disk=");
 	strncat(partitions_list, guid, UUID_STR_LEN + 1);
 	strcat(partitions_list, ";");
diff --git a/doc/README.gpt b/doc/README.gpt
index e29b188..754e490 100644
--- a/doc/README.gpt
+++ b/doc/README.gpt
@@ -156,10 +156,10 @@  Creating GPT partitions in U-Boot:
 To restore GUID partition table one needs to:
 1. Define partition layout in the environment.
    Format of partitions layout:
-     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
 	name=kernel,size=60MiB,uuid=...;"
      or
-     "partitions=uuid_disk=${uuid_gpt_disk};name=${uboot_name},
+     "uuid_disk=${uuid_gpt_disk};name=${uboot_name},
 	size=${uboot_size},uuid=${uboot_uuid};"
 
    The fields 'name' and 'size' are mandatory for every partition.
@@ -233,7 +233,7 @@  PARTITION_BASIC_DATA_GUID (EBD0A0A2-B9E5-4433-87C0-68B6B72699C7).
 If you define 'CONFIG_PARTITION_TYPE_GUID', a optionnal parameter 'type'
 can specify a other partition type guid:
 
-     "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+     "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
 	name=kernel,size=60MiB,uuid=...,
 	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4;"
 
@@ -255,7 +255,7 @@  Some strings can be also used at the place of known GUID :
 	"lvm"    = PARTITION_LINUX_LVM_GUID
 	           (E6D6D379-F507-44C2-A23C-238F2A3DF928)
 
-    "partitions=uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
+    "uuid_disk=...;name=u-boot,size=60MiB,uuid=...;
 	name=kernel,size=60MiB,uuid=...,type=linux;"
 
 They are also used to display the type of partition in "part list" command.