问题
I'm trying to read the U-Boot environment that is stored on eMMC, but I can't figure out how I can list the disks. The driver I'm creating is separated of the mmc device driver (/dev/mmcblk0p1).
I already found out that the partitions of mmcblk0
are struct mmc_part entries in struct mmc_card. Basically I'm searching for the mmc variant of __mtd_next_device.
EDIT 1:
I found out that I can get a block_device struct through bdget, but gendisk
points to NULL
.
struct block_device *my_bdevice;
struct gendisk *my_gdisk;
my_bdevice = bdget(179);
my_gdisk = part_to_disk(my_bdevice->bd_part);
if (!my_gdisk) goto end; // Goes to end..
回答1:
In my code above, my_bdevice = bdget(179);
is wrong:
dev_t devt = blk_lookup_devt("mmcblk0", 0);
my_bdevice = bdget(devt);
来源:https://stackoverflow.com/questions/64877659/how-can-i-list-mmc-partitions-in-a-linux-driver