
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