Skip to contentSkip to conversation

cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

PATCH New Sean Anderson 3 participants 5 messages Mar 9, 2021 – Apr 12, 2021 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

This allows using dev#partlabel syntax.

---

 fs/fs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fs.c +2 -2
index 900928c394..b7936fd4cf 100644
@@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 	}
 #endif
 
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
+						    &fs_partition, 1);
 	if (part < 0)
 		return -1;
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

Am 9. M?rz 2021 21:56:24 MEZ schrieb Sean Anderson <[email protected]>:

Quoted 1 line

This allows using dev#partlabel syntax.

Allowing more widespread use of that syntax makes sense to me.

Unfortunately you do not mention which commands and devices are affected.

Quoted 22 lines

---

fs/fs.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
fs/fs.c +2 -2
index 900928c394..b7936fd4cf 100644
@@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char
 *dev_part_str, int fstype)
 	}
 #endif
 
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str,
 &fs_dev_desc,
+						    &fs_partition, 1);
 	if (part < 0)
Quoted 2 lines
		return -1;

It would be good if we could test the new capabilities. Can we make use of sandbox_mmc.c?

Best regards

Heinrich

#2 lore raw

PATCH 1/1 cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

Quoted 6 lines · Heinrich Schuchardt

Am 9. M?rz 2021 21:56:24 MEZ schrieb Sean Anderson <[email protected]>:

Quoted 1 line

This allows using dev#partlabel syntax.

Allowing more widespread use of that syntax makes sense to me.

Unfortunately you do not mention which commands and devices are affected.

I enabled it so that cmd/fs.c can use it (e.g. CMD_FS_GENERIC).

It seems like I overlooked that this was in fs/fs.c and not cmd/fs.c.

Affected functionality should be most filesystem commands (due to do_load), DFU, fastboot, and splash screen. I suspect this affects almost every device using U-Boot.

Quoted 17 lines
Quoted 17 lines

---

fs/fs.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
fs/fs.c +0 -0
index 900928c394..b7936fd4cf 100644
@@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char
 *dev_part_str, int fstype)
 	}
 #endif
 
Quoted 10 lines
Quoted 8 lines
fs/fs.c +2 -2
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str,
 &fs_dev_desc,
+						    &fs_partition, 1);
 	if (part < 0)
		return -1;

It would be good if we could test the new capabilities. Can we make use of sandbox_mmc.c?

I suppose. There are already some tests in test/dm/fastboot.c along these lines. Fastboot calls into part_get_info_by_dev_and_name_or_num, so I think that is testing the same sort of thing. Perhaps they should be broken out into general partition tests. IMO this code path already has adequate tests.

--Sean

#3 lore raw

PATCH 1/1 cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

In reply to Sean Anderson
Quoted 13 lines · Sean Anderson

This allows using dev#partlabel syntax.

---

 fs/fs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fs.c +0 -0
index 900928c394..b7936fd4cf 100644

fs/fs.c int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) · line 391

Quoted 9 lines
fs/fs.c +2 -2
@@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 	}
 #endif
 
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
+						    &fs_partition, 1);
 	if (part < 0)
 		return -1;

This breaks a small number of platforms that have FS_LOADER support without PARTITION support:
xilinx_versal_mini xilinx_zynqmp_mini xilinx_zynqmp_mini_nand xilinx_zynqmp_mini_nand_single mt7620_mt7530_rfb mt7628_rfb and I suspect in all cases it's an intentional and valid config.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210412/248502b3/attachment.sig>
#4 lore raw

PATCH 1/1 cmd: fs: Use part_get_info_by_dev_and_name_or_num to parse partitions

Quoted 18 lines · Tom Rini
Quoted 16 lines · Sean Anderson

This allows using dev#partlabel syntax.

---

  fs/fs.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
fs/fs.c +0 -0
index 900928c394..b7936fd4cf 100644
@@ -385,8 +385,8 @@ int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
  	}
  #endif
 
Quoted 13 lines

fs/fs.c int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) · line 391

Quoted 6 lines
fs/fs.c +2 -2
-	part = blk_get_device_part_str(ifname, dev_part_str, &fs_dev_desc,
-					&fs_partition, 1);
+	part = part_get_info_by_dev_and_name_or_num(ifname, dev_part_str, &fs_dev_desc,
+						    &fs_partition, 1);
  	if (part < 0)
  		return -1;

This breaks a small number of platforms that have FS_LOADER support without PARTITION support:
xilinx_versal_mini xilinx_zynqmp_mini xilinx_zynqmp_mini_nand xilinx_zynqmp_mini_nand_single mt7620_mt7530_rfb mt7628_rfb and I suspect in all cases it's an intentional and valid config.

Ok, I will add a stub like what is done for blk_get_device_part_str in v2.

--Sean