On 15.01.16 00:11, Simon Glass wrote: > Hi Alexander, > > On 22 December 2015 at 06:57, Alexander Graf <ag...@suse.de> wrote: >> We have a pretty nice and generic interface to ask for a specific block >> device. However, that one is still based around the magic notion that >> we know the driver name. >> >> In order to be able to write fully generic disk access code, expose a list >> of all available block drivers. >> >> Signed-off-by: Alexander Graf <ag...@suse.de> >> --- >> disk/part.c | 25 +++++++++++++++++++++++++ >> include/part.h | 2 ++ >> 2 files changed, 27 insertions(+) >> >> diff --git a/disk/part.c b/disk/part.c >> index 909712e..5bc64c7 100644 >> --- a/disk/part.c >> +++ b/disk/part.c >> @@ -26,6 +26,31 @@ struct block_drvr { >> int (*select_hwpart)(int dev_num, int hwpart); >> }; >> >> +const char *available_block_drvrs[] = { >> +#if defined(CONFIG_CMD_IDE) >> + "ide", >> +#endif >> +#if defined(CONFIG_CMD_SATA) >> + "sata", >> +#endif >> +#if defined(CONFIG_CMD_SCSI) >> + "scsi", >> +#endif >> +#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE) >> + "usb", >> +#endif >> +#if defined(CONFIG_MMC) >> + "mmc", >> +#endif >> +#if defined(CONFIG_SYSTEMACE) >> + "ace", >> +#endif >> +#if defined(CONFIG_SANDBOX) >> + "host", >> +#endif >> + NULL, >> +}; > > You seem to be duplicating block_drvr[]. Can we not just use that?
It would mean that we'd have to make it public then - to me it looked like people kept it static for a reason. However if everyone's happy if I expose it (and the struct definition behind it), I'm certainly more than happy to move to that one instead :). Alex > >> + >> static const struct block_drvr block_drvr[] = { >> #if defined(CONFIG_CMD_IDE) >> { .name = "ide", .get_dev = ide_get_dev, }, >> diff --git a/include/part.h b/include/part.h >> index 720a867..dc2a78b 100644 >> --- a/include/part.h >> +++ b/include/part.h >> @@ -122,6 +122,8 @@ int get_device(const char *ifname, const char *dev_str, >> int get_device_and_partition(const char *ifname, const char *dev_part_str, >> block_dev_desc_t **dev_desc, >> disk_partition_t *info, int allow_whole_dev); >> + >> +extern const char *available_block_drvrs[]; >> #else >> static inline block_dev_desc_t *get_dev(const char *ifname, int dev) >> { return NULL; } >> -- >> 2.1.4 > Regards, > Simon > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot