[PATCH v2] cmd: usb_mass_storage: Use part_get_info_by_dev_and_name_or_num

This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
Signed-off-by: Sean Anderson sean.anderson@seco.com ---
Changes in v2: - Reword commit message to include an example
cmd/usb_mass_storage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index 14fa7233c7..d4e619b842 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -74,8 +74,8 @@ static int ums_init(const char *devtype, const char *devnums_part_str) if (!devnum_part_str) break;
- partnum = blk_get_device_part_str(devtype, devnum_part_str, - &block_dev, &info, 1); + partnum = part_get_info_by_dev_and_name_or_num(devtype, devnum_part_str, + &block_dev, &info, 1);
if (partnum < 0) goto cleanup;

On 7/8/21 7:36 PM, Sean Anderson wrote:
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
Shouldn't that be ums X mmc Y ?
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
That's all good, but is there some specification of the syntax somewhere instead of a random example ?
Is the current syntax still supported ?

On 7/8/21 2:00 PM, Marek Vasut wrote:
On 7/8/21 7:36 PM, Sean Anderson wrote:
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
Shouldn't that be ums X mmc Y ?
Yes.
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
That's all good, but is there some specification of the syntax somewhere instead of a random example ?\
Yes, see https://u-boot.readthedocs.io/en/latest/usage/partitions.html
I suppose that https://u-boot.readthedocs.io/en/latest/usage/ums.html should be updated as well, especially since the comma syntax is undocumented.
Is the current syntax still supported ?
Yes. This is completely backward-compatible.
--Sean

On 7/8/21 2:02 PM, Sean Anderson wrote:
On 7/8/21 2:00 PM, Marek Vasut wrote:
On 7/8/21 7:36 PM, Sean Anderson wrote:
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
Shouldn't that be ums X mmc Y ?
Yes.
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
That's all good, but is there some specification of the syntax somewhere instead of a random example ?\
Yes, see https://u-boot.readthedocs.io/en/latest/usage/partitions.html
I suppose that https://u-boot.readthedocs.io/en/latest/usage/ums.html should be updated as well, especially since the comma syntax is undocumented.
Upon closer inspection, the partition syntax is actually already documented. This patch just brings the command in-line with what is documented.
--Sean
Is the current syntax still supported ?
Yes. This is completely backward-compatible.
--Sean

Hi Marek,
On 7/22/21 2:24 PM, Sean Anderson wrote:
On 7/8/21 2:02 PM, Sean Anderson wrote:
On 7/8/21 2:00 PM, Marek Vasut wrote:
On 7/8/21 7:36 PM, Sean Anderson wrote:
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
Shouldn't that be ums X mmc Y ?
Yes.
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
That's all good, but is there some specification of the syntax somewhere instead of a random example ?\
Yes, see https://u-boot.readthedocs.io/en/latest/usage/partitions.html
I suppose that https://u-boot.readthedocs.io/en/latest/usage/ums.html should be updated as well, especially since the comma syntax is undocumented.
Upon closer inspection, the partition syntax is actually already documented. This patch just brings the command in-line with what is documented.
Does this patch need any additional modifications? As stated above, this new behavior is actually what is already documented.
--Sean

On 10/28/21 9:43 PM, Sean Anderson wrote:
Hi Marek,
On 7/22/21 2:24 PM, Sean Anderson wrote:
On 7/8/21 2:02 PM, Sean Anderson wrote:
On 7/8/21 2:00 PM, Marek Vasut wrote:
On 7/8/21 7:36 PM, Sean Anderson wrote:
This allows specifying partitions using more extended syntax. This is particularly useful to access eMMC hardware partitions. For example, this allows something like
ums mmc 0.0,0.1,0.2,0.3
Shouldn't that be ums X mmc Y ?
Yes.
to expose four LUNs for each of the four default eMMC hardware partitions. Note that the comma syntax was already present.
That's all good, but is there some specification of the syntax somewhere instead of a random example ?\
Yes, see https://u-boot.readthedocs.io/en/latest/usage/partitions.html
I suppose that https://u-boot.readthedocs.io/en/latest/usage/ums.html should be updated as well, especially since the comma syntax is undocumented.
Upon closer inspection, the partition syntax is actually already documented. This patch just brings the command in-line with what is documented.
Does this patch need any additional modifications? As stated above, this new behavior is actually what is already documented.
Update the commit message so the example isn't wrong (i.e. ums X mmc y).
Validate that "ums 0 mmc 0" still works for exporting the entire block device, if it does, then I can pick it.
Thanks
participants (2)
-
Marek Vasut
-
Sean Anderson