From: Alexander Graf Date: Fri, 4 Mar 2016 00:09:56 +0000 (+0100) Subject: disk/part.c: Expose list of available block drivers X-Git-Tag: v2016.05-rc1~374 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d96a98045aa5aadba473d89872a987ac50a023ea;p=u-boot disk/part.c: Expose list of available block drivers 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 the currently internal list to other source files so that they can scan through all available block drivers. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass Tested-by: Simon Glass --- diff --git a/disk/part.c b/disk/part.c index 2a46050392..67d98fe844 100644 --- a/disk/part.c +++ b/disk/part.c @@ -21,13 +21,7 @@ #define PRINTF(fmt,args...) #endif -struct block_drvr { - char *name; - struct blk_desc* (*get_dev)(int dev); - int (*select_hwpart)(int dev_num, int hwpart); -}; - -static const struct block_drvr block_drvr[] = { +const struct block_drvr block_drvr[] = { #if defined(CONFIG_CMD_IDE) { .name = "ide", .get_dev = ide_get_dev, }, #endif diff --git a/include/part.h b/include/part.h index 6d8f52049d..dc8e72e08f 100644 --- a/include/part.h +++ b/include/part.h @@ -10,6 +10,12 @@ #include #include +struct block_drvr { + char *name; + struct blk_desc* (*get_dev)(int dev); + int (*select_hwpart)(int dev_num, int hwpart); +}; + #define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \ ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \ ((x & 0xffff0000) ? 16 : 0)) @@ -165,6 +171,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str, int blk_get_device_part_str(const char *ifname, const char *dev_part_str, struct blk_desc **dev_desc, disk_partition_t *info, int allow_whole_dev); +extern const struct block_drvr block_drvr[]; #else static inline struct blk_desc *blk_get_dev(const char *ifname, int dev) { return NULL; }