[U-Boot] [PATCH 1/9] disk/part.c: Expose a list of available block drivers
Alexander Graf
agraf at suse.de
Tue Dec 22 14:57:48 CET 2015
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 <agraf at 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,
+};
+
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
More information about the U-Boot
mailing list