[PATCH v2 0/2] 'part name' subcommand and some robustification

Rasmus Villemoes ravi at prevas.dk
Mon Nov 10 01:33:10 CET 2025


On Sat, Nov 08 2025, Tom Rini <trini at konsulko.com> wrote:

> On Sat, Nov 08, 2025 at 01:02:14AM +0100, Rasmus Villemoes wrote:
>> On Fri, Nov 07 2025, Tom Rini <trini at konsulko.com> wrote:
>> 
>> > On Mon, Oct 20, 2025 at 02:10:58PM +0200, Rasmus Villemoes wrote:
>> >
>> >> Implement a "part name" subcommand, mirroring the existing "part
>> >> number" subcommand.
>> >> 
>> >> In the discussion for v1 of that, it came up that there's a bit of
>> >> inconsistency in how much and what one can assume to be initialized in
>> >> 'struct disk_partition' after a successful call of one of the
>> >> get_info* family of functions. The new patch 1/2 tries to consolidate
>> >> that by making sure all ->get_info invocations go through a common
>> >> helper that at least always initializes the string members.
>> >> 
>> >> Rasmus Villemoes (2):
>> >>   disk/part.c: ensure strings in struct disk_partition are valid after
>> >>     successful get_info
>> >>   cmd/part.c: implement "part name" subcommand
>> >> 
>> >>  cmd/gpt.c              |  4 +--
>> >>  cmd/part.c             | 16 ++++++++++-
>> >>  disk/part.c            | 62 ++++++++++++++++++++++++------------------
>> >>  doc/usage/cmd/part.rst | 13 +++++++++
>> >>  include/part.h         | 16 +++++++++++
>> >>  5 files changed, 81 insertions(+), 30 deletions(-)
>> >
>> > This leads to some of the bootstd tests failing in CI, unfortunately.
>> 
>> Do you have a link?
>
> Right, sorry:
> https://source.denx.de/u-boot/u-boot/-/jobs/1292597
>
>> Also, how exactly should one run those bootstd tests? When I just build
>> sandbox_defconfig and do 'ut bootstd', I get 130 failures, so I assume I
>> need to do something extra.
>
> So, you want to run it through pytest rather than directly, I find:
> https://docs.u-boot.org/en/latest/develop/pytest/usage.html
> And then
> https://lore.kernel.org/all/20251029143346.1320868-1-kory.maincent@bootlin.com
> has the full rather than partial list of host requirements, if you don't
> want to grab the docker container CI uses and run inside that.

Thanks, I think I figured out the problem. I'll resend properly
tomorrow, but this incremental diff should fix it:

diff --git a/disk/part.c b/disk/part.c
index 194eccadb7b..49a0fca6b89 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -360,8 +360,11 @@ int part_get_info_by_type(struct blk_desc *desc, int part, int part_type,
                }
 
                ret = part_driver_get_info(drv, desc, part, info);
-               if (!ret)
+               if (ret && ret != -ENOSYS) {
+                       ret = -ENOENT;
+               } else {
                        PRINTF("## Valid %s partition found ##\n", drv->name);
+               }
        }
 
        return ret;

In essence, the problem is/was that part_get_info_by_type() used to
translate any error from ->get_info into -ENOENT, so we have to preserve
that, while still doing the -ENOSYS thing.

Rasmus


More information about the U-Boot mailing list