mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Tobias Waldekranz <tobias@waldekranz.com>, barebox@lists.infradead.org
Subject: Re: [PATCH 2/5] dm: Add initial device mapper infrastructure
Date: Mon, 8 Sep 2025 20:40:03 +0200	[thread overview]
Message-ID: <96736e5f-b1f9-464b-92bd-d6c550245b64@pengutronix.de> (raw)
In-Reply-To: <87ldmp2t1f.fsf@waldekranz.com>

On 08.09.25 11:27, Tobias Waldekranz wrote:
> On fre, sep 05, 2025 at 18:14, Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>> If someone looks at this code, because they have seen this error, they
>> won't necessarily know how to interpret the %d.
> 
> My intention was that it could be correlated with the first column from
> the table generated by dm_asprint()...

Fair enough.

> 
>> Can you either add a comment above the iteration or rename the i to a
>> more telling name?
> 
> ...i.e., it is just an index (i). I'll add a comment describing that.

Ok. I was initially wondering if that's the "level" (e.g. dm-verity on top
of LVM) or something. A comment should be enough.

>> We don't support different block sizes right now and you hardcode
>> SECTOR_SIZE below anyway, but we like to pretend we could, so
>> blk->blockbits would be more apt here.
> 
> I made a conscious decision to use hardcode these everywhere as Linux
> defines that a DM block _is_ 512B. You see these constants all over the
> place in the target implementations in the kernel as well.
> 
> From dmsetup(8):
> | Devices are created by loading a table that specifies a target for
> | each sector (512 bytes) in the logical device.
> 
> So while Barebox might one day support other block sizes, I do not think
> that DM ever will.
> 
> What I also should have done is to have a comment detailing this, above
> the hardcoded block size. If I add this, do you think we should stick
> with the constants, or change to blk->blockbits?

Ok, let's keep it hardcoded then. A single comment in the probe function
is enough.

>>> +char *dm_asprint(struct dm_device *dm)
>>> +{
>>> +	char **strv, *str, *tistr;
>>> +	struct dm_target *ti;
>>> +	int n = 0, strc;
>>> +
>>> +	strc = 1 + dm_n_targets(dm);
>>> +	strv = xmalloc(strc * sizeof(*strv));
>>
>>
>> Meh, maybe we should have a growable string type...
> 
> I have taken a stab at this in v2 with rasprintf(), "the realloc()ing
> sprintf()". Let me know what you think.

Looking forward to it!


Cheers,
Ahmad


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-09-09  2:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 15:05 [PATCH 0/5] dm: Initial work on a device mapper Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 1/5] string: add strtok/strtokv Tobias Waldekranz
2025-09-04 11:00   ` Ahmad Fatoum
2025-09-04 13:35     ` Tobias Waldekranz
2025-09-05 16:28       ` Ahmad Fatoum
2025-09-08  9:26         ` Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 2/5] dm: Add initial device mapper infrastructure Tobias Waldekranz
2025-09-05 16:14   ` Ahmad Fatoum
2025-09-08  9:27     ` Tobias Waldekranz
2025-09-08 18:40       ` Ahmad Fatoum [this message]
2025-09-05 17:26   ` Ahmad Fatoum
2025-08-28 15:05 ` [PATCH 3/5] dm: linear: Add linear target Tobias Waldekranz
2025-08-29  5:56   ` Ahmad Fatoum
2025-09-05 16:37   ` Ahmad Fatoum
2025-08-28 15:05 ` [PATCH 4/5] test: self: dm: Add test of " Tobias Waldekranz
2025-09-05 16:50   ` Ahmad Fatoum
2025-09-08  9:27     ` Tobias Waldekranz
2025-09-08 18:53       ` Ahmad Fatoum
2025-08-28 15:05 ` [PATCH 5/5] commands: dmsetup: Basic command set for dm device management Tobias Waldekranz
2025-09-05 16:54   ` Ahmad Fatoum
2025-09-08  9:27     ` Tobias Waldekranz
2025-09-08 18:59       ` Ahmad Fatoum
2025-08-29  8:29 ` [PATCH 0/5] dm: Initial work on a device mapper Sascha Hauer
2025-08-31  7:48   ` Tobias Waldekranz
2025-09-02  8:40     ` Ahmad Fatoum
2025-09-02  9:44       ` Tobias Waldekranz
2025-08-29 11:24 ` Ahmad Fatoum
2025-08-31  7:48   ` Tobias Waldekranz
2025-09-02  9:03     ` Ahmad Fatoum
2025-09-02 13:01       ` Tobias Waldekranz
2025-09-03  7:05         ` Jan Lübbe
2025-09-02 14:46       ` Jan Lübbe
2025-09-02 21:34         ` Tobias Waldekranz
2025-09-03  6:50           ` Jan Lübbe
2025-09-03 20:19             ` Tobias Waldekranz
2025-09-05 14:44               ` Jan Lübbe
2025-09-02 14:34   ` Jan Lübbe

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=96736e5f-b1f9-464b-92bd-d6c550245b64@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=tobias@waldekranz.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox