On Tue, Oct 01, 2024 at 01:37:05AM -0700, Christoph Hellwig wrote: > On Tue, Sep 24, 2024 at 12:17:36PM +0200, Christian Marangi wrote: > > On Mon, Sep 23, 2024 at 11:34:53PM -0700, Christoph Hellwig wrote: > > > On Mon, Sep 23, 2024 at 12:59:32PM +0200, Christian Marangi wrote: > > > > +#define BOOT0_STR "boot0" > > > > +#define BOOT1_STR "boot1" > > > > + > > > > > > This boot0/1 stuff looks like black magic, so it should probably be > > > documented at very least. > > > > > > > It is but from what I have read in the spec for flash in general (this > > is not limited to eMMC but also apply to UFS) these are hardware > > partition. If the version is high enough these are always present and > > have boot0 and boot1 name hardcoded by the driver. > > How does this belong into generic block layer code? > (just as an info, we are at v4 where I added more info about this) The cmdline partition parser supports this already, just not clearly stated in the code but described in the Documentation example and info. > > > > + partitions_np = get_partitions_node(disk_np, > > > > + state->disk->disk_name); > > > > > > disk->disk_name is not a stable identifier and can change from boot to > > > boot due to async probing. You'll need to check a uuid or label instead. > > > > This is really for the 2 special partition up to check the suffix, we > > don't really care about the name. I guess it's acceptable to use > > unstable identifier? > > No. ->disk_name is in no way reliable, we can't hardcode that into > a partition parser. > Then any hint on this or alternative way? Again this is how it's done with cmdline partition so I'm just following how it's already done. Also I feel it's not clear enough that we really don't care about the identifier, eMMC driver hardcode and always append to disk_name boot0, boot1, the fact that one disk or another might have a different identifier and they change on different boot is not important for the task needed here. I can drop this thing entirely and make the implementation very simple but there are already request and happy dev that would benefits for the additional hardware partition supported by this. -- Ansuel