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 1/9] disk/part.c: Expose a list of available block drivers
Date: Fri, 15 Jan 2016 00:33:03 +0100	[thread overview]
Message-ID: <5698302F.3010201@suse.de> (raw)
In-Reply-To: <CAPnjgZ2tvaBGrbn4sk3h3etyfJyCyX6yDPDB27-HFr8-V_k9OQ@mail.gmail.com>



On 15.01.16 00:11, Simon Glass wrote:
> Hi Alexander,
> 
> On 22 December 2015 at 06:57, Alexander Graf <agraf@suse.de> wrote:
>> 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@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,
>> +};
> 
> You seem to be duplicating block_drvr[]. Can we not just use that?

It would mean that we'd have to make it public then - to me it looked
like people kept it static for a reason.

However if everyone's happy if I expose it (and the struct definition
behind it), I'm certainly more than happy to move to that one instead :).


Alex

> 
>> +
>>  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
> Regards,
> Simon
> 

  reply	other threads:[~2016-01-14 23:33 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 13:57 [U-Boot] [PATCH 0/9] EFI payload / application support Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 1/9] disk/part.c: Expose a list of available block drivers Alexander Graf
2016-01-14 19:18   ` Tom Rini
2016-01-14 23:11   ` Simon Glass
2016-01-14 23:33     ` Alexander Graf [this message]
2016-01-15  0:46       ` Simon Glass
2016-01-15  1:04         ` Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 2/9] include/efi_api.h: Add more detailed API definitions Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 3/9] efi_loader: Add PE image loader Alexander Graf
2015-12-26 16:26   ` Leif Lindholm
2016-01-14 23:45     ` Alexander Graf
2016-01-15 12:29       ` Leif Lindholm
2015-12-22 13:57 ` [U-Boot] [PATCH 4/9] efi_loader: Add boot time services Alexander Graf
2015-12-22 14:15   ` Andreas Färber
2015-12-22 14:31     ` Alexander Graf
2015-12-26 18:09   ` Leif Lindholm
2016-01-15  0:13     ` Alexander Graf
2016-01-15 13:02       ` Leif Lindholm
2016-01-15 14:14         ` Alexander Graf
2016-01-15 14:21           ` Leif Lindholm
2016-01-15 17:04             ` Alexander Graf
2016-01-15  3:40     ` Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 5/9] efi_loader: Add console interface Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 6/9] efi_loader: Add runtime services Alexander Graf
2015-12-26 18:33   ` Leif Lindholm
2016-01-15  0:26     ` Alexander Graf
2016-01-15 13:52       ` Leif Lindholm
2016-01-15 14:15         ` Alexander Graf
2016-01-15 14:22           ` Leif Lindholm
2015-12-22 13:57 ` [U-Boot] [PATCH 7/9] efi_loader: Add disk interfaces Alexander Graf
2016-01-15  1:37   ` Simon Glass
2016-01-15  2:40     ` Alexander Graf
2015-12-22 13:57 ` [U-Boot] [PATCH 8/9] efi_loader: Add "bootefi" command Alexander Graf
2015-12-24 11:15   ` Matwey V. Kornilov
2015-12-25  9:02     ` Alexander Graf
2015-12-25  9:25       ` Andreas Färber
2015-12-25  9:40         ` Matwey V. Kornilov
2015-12-25 17:04           ` Tom Rini
2015-12-26 18:55         ` Leif Lindholm
2015-12-27 15:33           ` Alexander Graf
2015-12-26 18:45       ` Leif Lindholm
2015-12-25 16:58     ` Tom Rini
2015-12-22 13:57 ` [U-Boot] [PATCH 9/9] efi_loader: hook up in build environment Alexander Graf
2015-12-22 18:28 ` [U-Boot] [PATCH 0/9] EFI payload / application support Matwey V. Kornilov
2015-12-22 20:32   ` Alexander Graf
2015-12-25  3:29 ` Tom Rini
2015-12-25  8:53   ` Alexander Graf
2015-12-25 16:50     ` Tom Rini
2015-12-25 16:53       ` Matwey V. Kornilov
2015-12-25 17:00         ` Tom Rini
2016-01-15  3:00       ` Alexander Graf
2016-01-15  3:06         ` Tom Rini
2015-12-25 19:34 ` Blibbet
2015-12-26 15:31 ` Leif Lindholm
2015-12-26 16:27   ` Alexander Graf
2015-12-26 19:34     ` Leif Lindholm
2016-01-04 16:25       ` Alexander Graf
2016-01-04 16:56         ` Tom Rini
2016-01-04 18:03           ` Andreas Färber
2016-01-04 18:41             ` Andreas Färber
2016-01-04 19:54               ` Tom Rini
2016-01-04 22:37                 ` Dennis Gilmore
2016-01-04 22:48                   ` Alexander Graf
2016-01-15  3:40             ` Peter Robinson
2016-01-04 20:11           ` Matwey V. Kornilov
2016-01-15  3:32           ` Peter Robinson
2015-12-27 18:10   ` Tom Rini
2015-12-27 18:39     ` Leif Lindholm
2015-12-27 19:48       ` Tom Rini
2016-01-05 20:18       ` Tom Rini

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=5698302F.3010201@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.