public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC, PATCH v4 05/16] env: fat: add U-Boot environment context support
Date: Fri, 19 Jul 2019 10:21:12 +0200	[thread overview]
Message-ID: <20190719082112.6D561240049@gemini.denx.de> (raw)
In-Reply-To: <20190717082525.891-6-takahiro.akashi@linaro.org>

Dear AKASHI Takahiro,

In message <20190717082525.891-6-takahiro.akashi@linaro.org> you wrote:
> Please note that the aim of this patch is to illustrate how we can
> extend the existing backing storage drivers for env interfaces to
> support U-Boot environment context.
>
> We will be able to support more devices as well as more contexts
> in a similar way. Existing drivers still work exactly in the same
> way as before while they are not extended yet.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  env/fat.c | 103 ++++++++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 84 insertions(+), 19 deletions(-)
>
> diff --git a/env/fat.c b/env/fat.c
> index 7f74c64dfe7e..e4a672d2730a 100644
> --- a/env/fat.c
> +++ b/env/fat.c
> @@ -30,23 +30,44 @@
>  # endif
>  #endif
>  
> +static struct evn_fat_context {
> +	char *interface;
> +	char *dev_and_part;
> +	char *file;
> +} fat_context[ENVCTX_COUNT] = {
> +#if defined(CONFIG_ENV_FAT_INTERFACE) && \
> +	defined(CONFIG_ENV_FAT_DEVICE_AND_PART) && defined(CONFIG_ENV_FAT_FILE)
> +	[ENVCTX_UBOOT] = {
> +		CONFIG_ENV_FAT_INTERFACE,
> +		CONFIG_ENV_FAT_DEVICE_AND_PART,
> +		CONFIG_ENV_FAT_FILE,
> +	},
> +#endif
> +};

Does it make sense to define this in a FAT specific way? I guess we
could come up with a common structure that covers all supported
storage devices and use this here.

Also, the "#if defined" looks really dangerous to me, as missing
#defines will go unnoticed, and in the end you are accessing
uninitialized data... 

Did you review the patchset for memory leaks? 


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you can't explain it to a six year old, you  don't  understand  it
yourself.                                           - Albert Einstein

  reply	other threads:[~2019-07-19  8:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  8:25 [U-Boot] [RFC, PATCH v4 00/16] efi_loader: non-volatile variables support AKASHI Takahiro
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 01/16] hashtable: extend interfaces to handle entries with context AKASHI Takahiro
2019-07-19  6:58   ` Wolfgang Denk
2019-07-19  7:44     ` AKASHI Takahiro
2019-07-19  9:49       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 02/16] env: extend interfaces to import/export U-Boot environment per context AKASHI Takahiro
2019-07-19  7:38   ` Wolfgang Denk
2019-07-19  8:15     ` AKASHI Takahiro
2019-07-19 10:04       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 03/16] env: extend interfaces to label variable with context AKASHI Takahiro
2019-07-19  8:09   ` Wolfgang Denk
2019-07-19  8:25     ` AKASHI Takahiro
2019-07-19 13:06       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 04/16] env: flash: add U-Boot environment context support AKASHI Takahiro
2019-07-19  8:14   ` Wolfgang Denk
2019-07-19  8:30     ` AKASHI Takahiro
2019-07-19 13:11       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 05/16] env: fat: " AKASHI Takahiro
2019-07-19  8:21   ` Wolfgang Denk [this message]
2019-07-19  8:35     ` AKASHI Takahiro
2019-07-19 13:14       ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 06/16] env: add variable storage attribute support AKASHI Takahiro
2019-07-19  8:35   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 07/16] env: add/expose attribute helper functions for hashtable AKASHI Takahiro
2019-07-19  8:36   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 08/16] hashtable: import/export entries with flags AKASHI Takahiro
2019-07-19  8:38   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 09/16] hashtable: extend hdelete_ext for autosave AKASHI Takahiro
2019-07-19  8:41   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 10/16] env: save non-volatile variables only AKASHI Takahiro
2019-07-19  8:45   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 11/16] env: save a context immediately if 'autosave' variable is changed AKASHI Takahiro
2019-07-19  8:48   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 12/16] env: extend interfaces to get/set attributes AKASHI Takahiro
2019-07-19  8:50   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 13/16] cmd: env: show variable storage attribute in "env flags" command AKASHI Takahiro
2019-07-19  9:05   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC,PATCH v4 14/16] env: fat: support UEFI context AKASHI Takahiro
2019-07-19  9:08   ` Wolfgang Denk
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 15/16] env, efi_loader: define flags for well-known global UEFI variables AKASHI Takahiro
2019-07-17  8:25 ` [U-Boot] [RFC, PATCH v4 16/16] efi_loader: variable: rework with new extended env interfaces AKASHI Takahiro
2019-07-17 18:53   ` Heinrich Schuchardt
2019-07-18  0:13     ` AKASHI Takahiro
2019-07-17 19:05 ` [U-Boot] [RFC, PATCH v4 00/16] efi_loader: non-volatile variables support Heinrich Schuchardt
2019-07-18  0:04   ` AKASHI Takahiro
2019-07-19  6:50 ` Wolfgang Denk
2019-07-19  7:36   ` AKASHI Takahiro
2019-07-19  9:41     ` Wolfgang Denk

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=20190719082112.6D561240049@gemini.denx.de \
    --to=wd@denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox