On 09/01/2017 05:35 PM, [ext] Andreas Reichel wrote:
From: Reichel Andreas <[email protected]>

For API refactoring, storage backend should be configurable

Signed-off-by: Andreas Reichel <[email protected]>
---
  Makefile.am                   |  4 ++--
  configure.ac                  | 25 ++++++++++++++++++++++++-
  env/env_api_fat.c             |  1 +
  include/env_api.h             |  5 ++++-
  tools/tests/Makefile          |  1 +
  tools/tests/test_partitions.c |  1 +
  6 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 321f10e..3d733b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,7 +43,7 @@ BUILD_TESTS = @build_tests@
  lib_LIBRARIES = libebgenv.a libenv_api.a
libebgenv_a_SOURCES = \
-       env/env_api_fat.c \
+       env/@[email protected] \
        tools/ebgpart.c \
        swupdate-adapter/ebgenv.c
@@ -56,7 +56,7 @@ libebgenv_a_CFLAGS = \ libenv_api_a_SOURCES = \
        tools/ebgpart.c \
-       env/env_api_fat.c
+       env/@[email protected]
libenv_api_a_CFLAGS = \
        $(AM_CFLAGS)
diff --git a/configure.ac b/configure.ac
index 80dd365..9a0f40b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,6 +134,27 @@ AC_TYPE_UINT16_T
  AC_TYPE_UINT32_T
  AC_TYPE_UINT8_T
+
+AC_ARG_WITH([env-type],
+           AS_HELP_STRING([--with-env-type=STRING],
+                          [specify the lds directory of gnuefi, defaults to 
"FAT"]),
+           [
+               case "$withval" in
+               FAT)
+               ENV_STORAGE_TYPE="FAT"
+               ENV_API_FILE="env_api_fat"

I would still like to see such switch cases gone. Updating them because of a new backend is a pain. If you go the "linker should resolve it route", you should just specify the 'ENV_API_FILE' variable here directly.

+               ;;
+               *)
+               AC_MSG_ERROR([bad value $withval for environment storage])
+               ;;
+               esac
+           ],
+           [
+               ENV_STORAGE_TYPE="FAT"

Is this variable only needed for printing the configuration? Not really necessary.

+               ENV_API_FILE="env_api_fat"
+           ])
+
+AC_SUBST([env_api_file], [${ENV_API_FILE}])
  # 
------------------------------------------------------------------------------
  AC_CONFIG_FILES([
          Makefile
@@ -147,11 +168,13 @@ AC_MSG_RESULT([
          machine type:            $MACHINE_TYPE_NAME
prefix: ${prefix}
-       exec_prefix:             ${exec_prefix}
+        exec_prefix:             ${exec_prefix}
          libexecdir:              ${libexecdir}
          libdir:                  ${libdir}
efi libs: ${GNUEFI_LIBS}
          efi lds:                 ${GNUEFI_LDS_DIR}
+
+       environment storage:     $ENV_STORAGE_TYPE
  ])
diff --git a/env/env_api_fat.c b/env/env_api_fat.c
index f282a3f..93b85a1 100644
--- a/env/env_api_fat.c
+++ b/env/env_api_fat.c
@@ -11,6 +11,7 @@
   */
#include "env_api.h"
+#include "ebgpart.h"
  #include "test-interface.h"
const char *tmp_mnt_dir = "/tmp/mnt-XXXXXX";
diff --git a/include/env_api.h b/include/env_api.h
index 70727e9..3e78ed3 100644
--- a/include/env_api.h
+++ b/include/env_api.h
@@ -26,8 +26,11 @@
  #include <fcntl.h>
  #include <sys/file.h>
  #include <sys/mount.h>
+#include "config.h"
-#include "ebgpart.h"
+#if ENV_STORAGE == 1

Where is this variable even defined?

+#      include "ebgpart.h"
+#endif
#include <zlib.h>
  #include "envdata.h"
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index f1fda2e..994dd59 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -22,6 +22,7 @@ INCLUDE ?= /usr/include
  CFLAGS = \
        -I$(PROJECTDIR) \
        -I$(PROJECTDIR)/.. \
+       -I$(PROJECTDIR)/../.. \
        -I$(PROJECTDIR)/../../include \
        -I$(PROJECTDIR)/../../swupdate-adapter \
        -std=gnu99 \
diff --git a/tools/tests/test_partitions.c b/tools/tests/test_partitions.c
index c6865e4..4387ecd 100644
--- a/tools/tests/test_partitions.c
+++ b/tools/tests/test_partitions.c
@@ -17,6 +17,7 @@
  #include <setjmp.h>
  #include <cmocka.h>
  #include "env_api.h"
+#include "ebgpart.h"
  #include "test-interface.h"
static PedDevice ped_devices[32] = {0};


--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected]

--
You received this message because you are subscribed to the Google Groups "EFI Boot 
Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/7adf7d9e-e8f8-8732-fce3-4aab5ece783e%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to