
for ( uclass_first_device(UCLASS_BLK, &dev); dev; uclass_next_device(&dev) ) { struct blk_desc *desc = dev_get_uclass_platdata(dev); if (part_get_info_whole_disk(desc, &info) == 0) { But to my surprise, fs_devread() of any device other than the one given on command line, will fail. Most likely because blk_dread() ops->read is NULL? Maybe?
That was not it at all. Turns out the problem is that os_read() would return a partition read request, and fs_devread() calling blk_dread() does not handle a partial read at all. But that is fine,
The issue is that when fs_devread() converts my 131072 byte_len, into 131072 block_len, because blk->log2blksz == 0.
Turns out that blk->log2blksz is only set in blk_get_device_part_str() so this function has to be called before using a device.
So I can change my code to call uclass_first_device() then;
1) Convert the device info to strings, and call blk_get_device_part_str(). 2) Set blk->log2blksz myself and hope there are no other surprises.
Lund