Commit d96a98045aa5aadba473d89872a987ac50a023ea

Authored by Alexander Graf
Committed by Tom Rini
1 parent 19503c3117

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 <agraf@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 8 additions and 7 deletions Side-by-side Diff

... ... @@ -21,13 +21,7 @@
21 21 #define PRINTF(fmt,args...)
22 22 #endif
23 23  
24   -struct block_drvr {
25   - char *name;
26   - struct blk_desc* (*get_dev)(int dev);
27   - int (*select_hwpart)(int dev_num, int hwpart);
28   -};
29   -
30   -static const struct block_drvr block_drvr[] = {
  24 +const struct block_drvr block_drvr[] = {
31 25 #if defined(CONFIG_CMD_IDE)
32 26 { .name = "ide", .get_dev = ide_get_dev, },
33 27 #endif
... ... @@ -10,6 +10,12 @@
10 10 #include <blk.h>
11 11 #include <ide.h>
12 12  
  13 +struct block_drvr {
  14 + char *name;
  15 + struct blk_desc* (*get_dev)(int dev);
  16 + int (*select_hwpart)(int dev_num, int hwpart);
  17 +};
  18 +
13 19 #define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \
14 20 ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \
15 21 ((x & 0xffff0000) ? 16 : 0))
... ... @@ -165,6 +171,7 @@
165 171 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
166 172 struct blk_desc **dev_desc,
167 173 disk_partition_t *info, int allow_whole_dev);
  174 +extern const struct block_drvr block_drvr[];
168 175 #else
169 176 static inline struct blk_desc *blk_get_dev(const char *ifname, int dev)
170 177 { return NULL; }