[PATCH v2] mtd: implement proper partition handling

Richard Weinberger richard at nod.at
Wed Jan 8 15:34:18 PST 2020


----- Ursprüngliche Mail -----
> Von: "Miquel Raynal" <miquel.raynal at bootlin.com>
> An: "richard" <richard at nod.at>, "Vignesh Raghavendra" <vigneshr at ti.com>, "Tudor Ambarus" <Tudor.Ambarus at microchip.com>,
> "linux-mtd" <linux-mtd at lists.infradead.org>
> CC: "Boris Brezillon" <boris.brezillon at collabora.com>, "Thomas Petazzoni" <thomas.petazzoni at bootlin.com>, "Miquel
> Raynal" <miquel.raynal at bootlin.com>
> Gesendet: Montag, 30. Dezember 2019 12:19:48
> Betreff: [PATCH v2] mtd: implement proper partition handling

> Instead of collecting partitions in a flat list, create a hierarchy
> within the mtd_info structure: use a partitions list to keep track of
> the partitions of an MTD device (which might be itself a partition of
> another MTD device), a pointer to the parent device (NULL when the MTD
> device is the root one, not a partition).

What problem does this solve?
...beside of a nice diffstat which removes more than it adds. :-)

> By also saving directly in mtd_info the offset of the partition, we
> can get rid of the mtd_part structure.
> 
> While at it, be consistent in the naming of the mtd_info structures to
> ease the understanding of the new hierarchy: these structures are
> usually called 'mtd', unless there are multiple instances of the same
> structure. In this case, there is usually a parent/child bound so we
> will call them 'parent' and 'child'.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>

[...]

> +static inline struct mtd_info *mtd_get_master(struct mtd_info *mtd)
> +{
> +	while (mtd->parent)
> +		mtd = mtd->parent;
> +
> +	return mtd;
> +}

So, parent == master?

When I create a MTD ontop of UBI using gluebi, who will be parent/master?

Thanks,
//richard



More information about the linux-mtd mailing list