All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Quentin Schulz <quentin.schulz@cherry.de>
Cc: <u-boot@lists.denx.de>,  Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH] cmd/part.c: implement "part name" subcommand
Date: Fri, 17 Oct 2025 10:22:02 +0200	[thread overview]
Message-ID: <87ecr2ndjp.fsf@prevas.dk> (raw)
In-Reply-To: <6e85c247-9624-472c-bbdb-b35be4fa03a4@cherry.de> (Quentin Schulz's message of "Thu, 16 Oct 2025 15:28:25 +0200")

On Thu, Oct 16 2025, Quentin Schulz <quentin.schulz@cherry.de> wrote:

> Hi Rasmus,
>
> On 10/16/25 2:52 PM, Rasmus Villemoes wrote:
>> This is a natural buddy to the existing "part number", allowing one to
>> get the partition name for a given partition number.
>> 
>
> Can you update the documentation in doc/usage/cmd/part.rst as well?

Will do, thanks.

>>   cmd/part.c | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
>> diff --git a/cmd/part.c b/cmd/part.c
>> index db7bc5819c0..975a0a08a99 100644
>> --- a/cmd/part.c
>> +++ b/cmd/part.c
>> @@ -25,7 +25,8 @@
>>   enum cmd_part_info {
>>   	CMD_PART_INFO_START = 0,
>>   	CMD_PART_INFO_SIZE,
>> -	CMD_PART_INFO_NUMBER
>> +	CMD_PART_INFO_NUMBER,
>> +	CMD_PART_INFO_NAME,
>>   };
>>     static int do_part_uuid(int argc, char *const argv[])
>> @@ -154,6 +155,9 @@ static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
>>   	case CMD_PART_INFO_NUMBER:
>>   		snprintf(buf, sizeof(buf), "0x%x", part);
>>   		break;
>> +	case CMD_PART_INFO_NAME:
>> +		snprintf(buf, sizeof(buf), "%s", info.name);
>
> Is it possible info.name is never set by the fs/blk driver? Should we
> initialize this field?
>

So I took a look, and it seems that all but part_amiga.c do initialize
it.

- iso and dos uses part_set_generic_name()

- mac and efi have real data from the partition table to put in

- mtd also initializes name, either from a name defined in mtdparts or a
  size@offset generated one

- ubi uses the volume name

I suppose we should make sure info.name is zero-initialized (or, at
least, that info.name[0] is 0 so there's a valid C string). But I think
that shouldn't have to be the responsibility of every caller of
part_get_info(). IOW, I think we should just add

	info->name[0] = '\0';
	info->type[0] = '\0';

into part_get_info_by_type(), and then that's a separate patch. WDYT?

Rasmus

  reply	other threads:[~2025-10-17  8:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 12:52 [PATCH] cmd/part.c: implement "part name" subcommand Rasmus Villemoes
2025-10-16 13:28 ` Quentin Schulz
2025-10-17  8:22   ` Rasmus Villemoes [this message]
2025-10-17  9:09     ` Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ecr2ndjp.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=quentin.schulz@cherry.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.