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 <ag...@suse.de> --- disk/part.c | 7 +------ include/part.h | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/disk/part.c b/disk/part.c index 909712e..7f937d9 100644 --- a/disk/part.c +++ b/disk/part.c @@ -20,13 +20,8 @@ #define PRINTF(fmt,args...) #endif -struct block_drvr { - char *name; - block_dev_desc_t* (*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 720a867..bc491d2 100644 --- a/include/part.h +++ b/include/part.h @@ -41,6 +41,12 @@ typedef struct block_dev_desc { void *priv; /* driver private struct pointer */ }block_dev_desc_t; +struct block_drvr { + char *name; + block_dev_desc_t* (*get_dev)(int dev); + int (*select_hwpart)(int dev_num, int hwpart); +}; + #define BLOCK_CNT(size, block_dev_desc) (PAD_COUNT(size, block_dev_desc->blksz)) #define PAD_TO_BLOCKSIZE(size, block_dev_desc) \ (PAD_SIZE(size, block_dev_desc->blksz)) @@ -122,6 +128,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 struct block_drvr block_drvr[]; #else static inline block_dev_desc_t *get_dev(const char *ifname, int dev) { return NULL; } -- 2.1.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot