All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/16] disk/part.c: Expose list of available block drivers
Date: Tue,  2 Feb 2016 03:44:59 +0100	[thread overview]
Message-ID: <1454381114-22547-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1454381114-22547-1-git-send-email-agraf@suse.de>

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>
---
 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 1935b28..d265c2b 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 dc23949..6e6205b 100644
--- a/include/part.h
+++ b/include/part.h
@@ -42,6 +42,12 @@ struct block_dev_desc {
 	void		*priv;		/* driver private struct pointer */
 };
 
+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))
@@ -123,6 +129,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.6.2

  reply	other threads:[~2016-02-02  2:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  2:44 [U-Boot] [PATCH 00/16] EFI payload / application support v3 Alexander Graf
2016-02-02  2:44 ` Alexander Graf [this message]
2016-02-03  3:31   ` [U-Boot] [PATCH 01/16] disk/part.c: Expose list of available block drivers Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 02/16] include/efi_api.h: Add more detailed API definitions Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 03/16] efi_loader: Add PE image loader Alexander Graf
2016-02-02 12:54   ` Leif Lindholm
2016-02-02 17:49   ` Mark Rutland
2016-02-26  1:25     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 04/16] efi_loader: Add boot time services Alexander Graf
2016-02-02 14:47   ` Leif Lindholm
2016-02-26  1:00     ` Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 05/16] efi_loader: Add console interface Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 06/16] efi_loader: Add runtime services Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 07/16] efi_loader: Add disk interfaces Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 08/16] efi_loader: Add "bootefi" command Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 09/16] efi_loader: Implement memory allocation and map Alexander Graf
2016-02-02 17:35   ` Leif Lindholm
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 10/16] arm64: Allow exceptions to return Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 11/16] arm64: Allow EFI payload code to take exceptions Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 12/16] efi_loader: Add DCACHE_OFF support for arm64 Alexander Graf
2016-02-02 15:55   ` Mark Rutland
2016-02-02 16:28     ` Tom Rini
2016-02-02 16:58       ` Alexander Graf
2016-02-02  2:45 ` [U-Boot] [PATCH 13/16] efi_loader: hook up in build environment Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 14/16] efi_loader: Add distro boot script for removable media Alexander Graf
2016-02-02 17:52   ` Leif Lindholm
2016-02-26  1:29     ` Alexander Graf
2016-02-03 10:36   ` Leif Lindholm
2016-02-03 15:53     ` Alexander Graf
2016-02-04  4:11       ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 15/16] efi_loader: Add README section in README.efi Alexander Graf
2016-02-03  3:31   ` Simon Glass
2016-02-02  2:45 ` [U-Boot] [PATCH 16/16] efi_loader: Add MAINTAINERS entry Alexander Graf
2016-02-03  3:31   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454381114-22547-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.