All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disk: part: change from hextoul to dectoul
       [not found] <CGME20220617100206epcas1p3854167abec585c75c56ce15ebc60c493@epcas1p3.samsung.com>
@ 2022-06-17 10:01 ` Jaehoon Chung
  2022-06-17 12:27   ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Jaehoon Chung @ 2022-06-17 10:01 UTC (permalink / raw)
  To: u-boot
  Cc: sjg, xypron.glpk, sean.anderson, schspa, takahiro.akashi,
	oleksii.bidnichenko, trini, Jaehoon Chung

When 'ls' command is running with partition number, it's passed by a hex
value. For example, if want to check a 15th partition, it has to input
as 0xf.
Before applied
- ls mmc 0:f
After applied
- ls mmc 0:15

The using decimal number is more readable than passed by a hex value.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
---
 disk/part.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disk/part.c b/disk/part.c
index 79955c7fb000..31a42d8a2312 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -540,7 +540,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 		part = PART_AUTO;
 	} else {
 		/* Something specified -> use exactly that */
-		part = (int)hextoul(part_str, &ep);
+		part = (int)dectoul(part_str, &ep);
 		/*
 		 * Less than whole string converted,
 		 * or request for whole device, but caller requires partition.
-- 
2.25.1


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

* Re: [PATCH] disk: part: change from hextoul to dectoul
  2022-06-17 10:01 ` [PATCH] disk: part: change from hextoul to dectoul Jaehoon Chung
@ 2022-06-17 12:27   ` Tom Rini
  2022-06-20  0:46     ` Jaehoon Chung
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rini @ 2022-06-17 12:27 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: u-boot, sjg, xypron.glpk, sean.anderson, schspa, takahiro.akashi,
	oleksii.bidnichenko

[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]

On Fri, Jun 17, 2022 at 07:01:59PM +0900, Jaehoon Chung wrote:

> When 'ls' command is running with partition number, it's passed by a hex
> value. For example, if want to check a 15th partition, it has to input
> as 0xf.
> Before applied
> - ls mmc 0:f
> After applied
> - ls mmc 0:15
> 
> The using decimal number is more readable than passed by a hex value.
> 
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

NAK.  I agree it's a more obvious way of interacting.  But the CLI is
our API with our users and there's lots of stuff out there today that
knows (and then deals with) needing to pass hex not decimal for
partitions.  And given SoCs that have large numbers of partitions, you
can't assume that "12" isn't in intentional and referring to partition
18 in decimal.

We could maybe do this with a flag or environment variable to allow
people to opt-in, since that would at least allow for multi-platform
scripts to know what to expect and not have to guess / hard-code per
platform.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH] disk: part: change from hextoul to dectoul
  2022-06-17 12:27   ` Tom Rini
@ 2022-06-20  0:46     ` Jaehoon Chung
  0 siblings, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2022-06-20  0:46 UTC (permalink / raw)
  To: Tom Rini
  Cc: u-boot, sjg, xypron.glpk, sean.anderson, schspa, takahiro.akashi,
	oleksii.bidnichenko

Hi Tom,

On 6/17/22 21:27, Tom Rini wrote:
> On Fri, Jun 17, 2022 at 07:01:59PM +0900, Jaehoon Chung wrote:
> 
>> When 'ls' command is running with partition number, it's passed by a hex
>> value. For example, if want to check a 15th partition, it has to input
>> as 0xf.
>> Before applied
>> - ls mmc 0:f
>> After applied
>> - ls mmc 0:15
>>
>> The using decimal number is more readable than passed by a hex value.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> 
> NAK.  I agree it's a more obvious way of interacting.  But the CLI is
> our API with our users and there's lots of stuff out there today that
> knows (and then deals with) needing to pass hex not decimal for
> partitions.  And given SoCs that have large numbers of partitions, you
> can't assume that "12" isn't in intentional and referring to partition
> 18 in decimal.
> 
> We could maybe do this with a flag or environment variable to allow
> people to opt-in, since that would at least allow for multi-platform
> scripts to know what to expect and not have to guess / hard-code per
> platform.

Okay. Frankly, I were not sure that it needs to change or not.
In our boot script, I'm using the hex value and decimal value as other environment variable.
I agreed yours. 

Best Regards,
Jaehoon Chung


> 


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

end of thread, other threads:[~2022-06-20  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220617100206epcas1p3854167abec585c75c56ce15ebc60c493@epcas1p3.samsung.com>
2022-06-17 10:01 ` [PATCH] disk: part: change from hextoul to dectoul Jaehoon Chung
2022-06-17 12:27   ` Tom Rini
2022-06-20  0:46     ` Jaehoon Chung

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.