Hi,

On 08/22/2017 06:15 PM, [ext] Reichel Andreas wrote:
From: Andreas Reichel <[email protected]>

From: Reichel Andreas <[email protected]>

* bg_utils is actually a core API, thus rename it to env_api
* move include files to include directory
* adapt Makefiles

Signed-off-by: Andreas Reichel <[email protected]>
---
  Makefile.am                           | 18 +++++++++---------
  tools/bg_utils.c => env/env_api_fat.c |  2 +-
  {tools => include}/ebgpart.h          |  0
  tools/bg_utils.h => include/env_api.h |  0
  {tools => include}/test-interface.h   |  2 +-
  swupdate-adapter/ebgenv.c             |  2 +-
  tools/bg_setenv.c                     |  2 +-
  tools/tests/Makefile                  | 23 ++++++++++++++---------
  tools/tests/test_api.c                |  2 +-
  tools/tests/test_environment.c        |  2 +-
  tools/tests/test_partitions.c         |  2 +-
  11 files changed, 30 insertions(+), 25 deletions(-)
  rename tools/bg_utils.c => env/env_api_fat.c (99%)
  rename {tools => include}/ebgpart.h (100%)
  rename tools/bg_utils.h => include/env_api.h (100%)
  rename {tools => include}/test-interface.h (96%)

diff --git a/Makefile.am b/Makefile.am
index 717ba05..f845c68 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -40,10 +40,10 @@ BUILD_TESTS = @build_tests@
  #
  # Static libraries
  #
-lib_LIBRARIES = libebgenv.a libbg_utils.a
+lib_LIBRARIES = libebgenv.a libenv_api.a

So the new name is 'libenv_api'? So you are the one that is creating the ultimate environment_api that will rule all other environment apis? ;)

I would prefer something with 'ebg' or 'bg' as prefix for all not so ambitions endeavors.

Claudius

libebgenv_a_SOURCES = \
-       tools/bg_utils.c \
+       env/env_api_fat.c \
        tools/ebgpart.c \
        swupdate-adapter/ebgenv.c
@@ -54,16 +54,16 @@ libebgenv_a_CPPFLAGS = \
  libebgenv_a_CFLAGS = \
        $(AM_CFLAGS)
-libbg_utils_a_SOURCES = \
+libenv_api_a_SOURCES = \
        tools/ebgpart.c \
-       tools/bg_utils.c
+       env/env_api_fat.c
-libbg_utils_a_CFLAGS = \
+libenv_api_a_CFLAGS = \
        $(AM_CFLAGS)
pkginclude_HEADERS = \
        swupdate-adapter/ebgenv.h \
-       tools/bg_utils.h
+       include/env_api.h
#
  # bg_setenv binary
@@ -78,11 +78,11 @@ bg_setenv_CFLAGS = \
        $(AM_CFLAGS)
bg_setenv_LDADD = \
-       -lbg_utils \
+       -lenv_api \
        -lz
bg_setenv_DEPENDENCIES = \
-       libbg_utils.a
+       libenv_api.a
install-exec-hook:
        $(LN_S) bg_setenv$(EXEEXT) \
@@ -194,7 +194,7 @@ bg_printenv: $(bg_setenv) build_tests
build_tests:
        @if [ "x$(BUILD_TESTS)" = "x1" ]; then\
-               make -C tools/tests;\
+               make -C tools/tests ENV_API=env_api_fat;\
        fi
clean-local:
diff --git a/tools/bg_utils.c b/env/env_api_fat.c
similarity index 99%
rename from tools/bg_utils.c
rename to env/env_api_fat.c
index 496e2c8..f282a3f 100644
--- a/tools/bg_utils.c
+++ b/env/env_api_fat.c
@@ -10,7 +10,7 @@
   * the COPYING file in the top-level directory.
   */
-#include "bg_utils.h"
+#include "env_api.h"
  #include "test-interface.h"
const char *tmp_mnt_dir = "/tmp/mnt-XXXXXX";
diff --git a/tools/ebgpart.h b/include/ebgpart.h
similarity index 100%
rename from tools/ebgpart.h
rename to include/ebgpart.h
diff --git a/tools/bg_utils.h b/include/env_api.h
similarity index 100%
rename from tools/bg_utils.h
rename to include/env_api.h
diff --git a/tools/test-interface.h b/include/test-interface.h
similarity index 96%
rename from tools/test-interface.h
rename to include/test-interface.h
index d0bf6d4..cceb1cb 100644
--- a/tools/test-interface.h
+++ b/include/test-interface.h
@@ -13,7 +13,7 @@
  #ifndef __TEST_INTERFACE_H__
  #define __TEST_INTERFACE_H__
-#include "bg_utils.h"
+#include "env_api.h"
bool read_env(CONFIG_PART *part, BG_ENVDATA *env);
  bool write_env(CONFIG_PART *part, BG_ENVDATA *env);
diff --git a/swupdate-adapter/ebgenv.c b/swupdate-adapter/ebgenv.c
index 4c767ee..9ac42fc 100644
--- a/swupdate-adapter/ebgenv.c
+++ b/swupdate-adapter/ebgenv.c
@@ -10,7 +10,7 @@
   * the COPYING file in the top-level directory.
   */
-#include "bg_utils.h"
+#include "env_api.h"
  #include "ebgdefs.h"
  #include "ebgenv.h"
diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index 07f6610..946ce92 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -10,7 +10,7 @@
   * the COPYING file in the top-level directory.
   */
-#include "bg_utils.h"
+#include "env_api.h"
static char doc[] =
      "bg_setenv/bg_printenv - Environment tool for the EFI Boot Guard";
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index d52deaa..1633a72 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -44,6 +44,8 @@ LIBS = -L../.. \
           -lebgenv \
           -lz
+ENV_API ?= env_api_fat
+
  # Test recipes shall run everytime independent of already built files.
  # A simple way to achieve this is to depend on files that don't exist
  # by changing their extension with Makefile's string functions.
@@ -51,20 +53,20 @@ LIBS = -L../.. \
  # dependency recipes.
  # All targets' '.target' extensions get removed within the target recipes.
  #
-OBJS_test_partitions = test_partitions.O bg_utils.O ebgpart.O
-OBJS_test_environment = test_environment.O bg_utils.O ebgpart.O
-OBJS_test_api = test_api.O bg_utils.O ebgenv.O
+OBJS_test_partitions = test_partitions.O $(ENV_API).O ebgpart.O
+OBJS_test_environment = test_environment.O $(ENV_API).O ebgpart.O
+OBJS_test_api = test_api.O $(ENV_API).O ebgenv.O
-MOCKOBJS_test_partitions = bg_utils ebgpart
-MOCKOBJS_test_environment = bg_utils
-MOCKOBJS_test_api = bg_utils
+MOCKOBJS_test_partitions = $(ENV_API) ebgpart
+MOCKOBJS_test_environment = $(ENV_API)
+MOCKOBJS_test_api = $(ENV_API)
# Define symbols to be stripped dependent on target and object file name
  # MOCKOBJS_SYMBOLS_objectname-targetname = symbolname1 symbolname2 ...
-MOCKOBJS_SYMBOLS_bg_utils-test_partitions = probe_config_file
-MOCKOBJS_SYMBOLS_bg_utils-test_environment = oldenvs configparts fopen fclose 
fread fwrite feof mount_partition
-MOCKOBJS_SYMBOLS_bg_utils-test_api = bgenv_init bgenv_write bgenv_close 
bgenv_get_latest bgenv_get_by_index bgenv_get_oldest
+MOCKOBJS_SYMBOLS_$(ENV_API)-test_partitions = probe_config_file
+MOCKOBJS_SYMBOLS_$(ENV_API)-test_environment = oldenvs configparts fopen 
fclose fread fwrite feof mount_partition
+MOCKOBJS_SYMBOLS_$(ENV_API)-test_api = bgenv_init bgenv_write bgenv_close 
bgenv_get_latest bgenv_get_by_index bgenv_get_oldest
  MOCKOBJS_SYMBOLS_ebgpart-test_partitions = ped_device_probe_all 
ped_device_get_next ped_disk_next_partition
TEST_TARGETS = test_partitions.target test_environment.target test_api.target
@@ -98,6 +100,9 @@ $(foreach test,$(TEST_TARGETS),$(eval $(call 
TEST_TARGET_TEMPLATE,$(test))))
  %.O: ../%.c
        $(CC) $(CFLAGS) $(DEFINES) -c $< -o $(@:O=o)
+%.O: ../../env/%.c
+       $(CC) $(CFLAGS) $(DEFINES) -c $< -o $(@:O=o)
+
  %.O: ../../swupdate-adapter/%.c
        $(CC) $(CFLAGS) $(DEFINES) -c $< -o $(@:O=o)
diff --git a/tools/tests/test_api.c b/tools/tests/test_api.c
index fb6e658..cca4573 100644
--- a/tools/tests/test_api.c
+++ b/tools/tests/test_api.c
@@ -18,7 +18,7 @@
  #include <cmocka.h>
  #include <string.h>
  #include <error.h>
-#include "bg_utils.h"
+#include "env_api.h"
  #include "ebgenv.h"
static BGENV env = {0};
diff --git a/tools/tests/test_environment.c b/tools/tests/test_environment.c
index fe9d50e..63df653 100644
--- a/tools/tests/test_environment.c
+++ b/tools/tests/test_environment.c
@@ -17,7 +17,7 @@
  #include <setjmp.h>
  #include <cmocka.h>
  #include <string.h>
-#include "bg_utils.h"
+#include "env_api.h"
  #include "test-interface.h"
/* Mock functions from libparted */
diff --git a/tools/tests/test_partitions.c b/tools/tests/test_partitions.c
index 6781b79..c6865e4 100644
--- a/tools/tests/test_partitions.c
+++ b/tools/tests/test_partitions.c
@@ -16,7 +16,7 @@
  #include <stdbool.h>
  #include <setjmp.h>
  #include <cmocka.h>
-#include "bg_utils.h"
+#include "env_api.h"
  #include "test-interface.h"
static PedDevice ped_devices[32] = {0};


--
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/86b81164-e7fd-2921-c97c-049a4a4361c4%40siemens.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to