[PATCH] constants: moved ENV_FILE_NAME and FAT_ENV_FILENAME to separate file

8 views
Skip to first unread message

Tobias Schmidl

unread,
Sep 9, 2022, 4:31:34 AM9/9/22
to efibootg...@googlegroups.com, Tobias Schmidl
We have two variables that are really dependent on each other. But,
since both header files compile with different runtimes, we cannot
simply have one include the other. So instead, we move these dependent
variables to a shared third file.

Signed-off-by: Tobias Schmidl <tobias...@siemens.com>
---
include/bootguard.h | 4 ++--
include/constants.h | 20 ++++++++++++++++++++
include/envdata.h | 4 ++--
3 files changed, 24 insertions(+), 4 deletions(-)
create mode 100644 include/constants.h

diff --git a/include/bootguard.h b/include/bootguard.h
index 8e38d95..c1b4e18 100644
--- a/include/bootguard.h
+++ b/include/bootguard.h
@@ -16,6 +16,8 @@

#include <efi.h>

+#include "constants.h"
+
/* The following definitions regarding status and error constants are
* implemented the same way the corresponding gnu-efi constants are
* defined. This is done for symmetry reasons and for the sake of
@@ -31,8 +33,6 @@ typedef int BG_STATUS;

#define DEFAULT_TIMEOUT_SEC 60

-#define ENV_FILE_NAME L"BGENV.DAT"
-
extern EFI_HANDLE this_image;

typedef struct _BG_LOADER_PARAMS {
diff --git a/include/constants.h b/include/constants.h
new file mode 100644
index 0000000..67605da
--- /dev/null
+++ b/include/constants.h
@@ -0,0 +1,20 @@
+/*
+ * EFI Boot Guard
+ *
+ * Copyright (c) Siemens AG, 2022
+ *
+ * Authors:
+ * Tobias Schmidl <tobias...@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#pragma once
+
+#define ENV_FILE_NAME L"BGENV.DAT"
+#define FAT_ENV_FILENAME "BGENV.DAT"
+#define ENV_STRING_LENGTH 255
+
diff --git a/include/envdata.h b/include/envdata.h
index fddfa7f..cd274f4 100644
--- a/include/envdata.h
+++ b/include/envdata.h
@@ -16,8 +16,8 @@

#include <stdint.h>

-#define FAT_ENV_FILENAME "BGENV.DAT"
-#define ENV_STRING_LENGTH 255
+#include "constants.h"
+

#define USTATE_OK 0
#define USTATE_INSTALLED 1
--
2.37.2

Schmidl, Tobias

unread,
Sep 28, 2022, 1:13:38 AM9/28/22
to efibootg...@googlegroups.com
Hi all,

Am Freitag, dem 09.09.2022 um 10:31 +0200 schrieb Tobias Schmidl:
> We have two variables that are really dependent on each other. But,
> since both header files compile with different runtimes, we cannot
> simply have one include the other. So instead, we move these dependent
> variables to a shared third file.
>
> Signed-off-by: Tobias Schmidl <tobias...@siemens.com>

are there any impediments for this patch?

Kind regards,

Tobias

Jan Kiszka

unread,
Sep 28, 2022, 2:17:43 AM9/28/22
to Tobias Schmidl, efibootg...@googlegroups.com
On 09.09.22 10:31, Tobias Schmidl wrote:
> We have two variables that are really dependent on each other. But,
> since both header files compile with different runtimes, we cannot
> simply have one include the other. So instead, we move these dependent
> variables to a shared third file.
>
> Signed-off-by: Tobias Schmidl <tobias...@siemens.com>
> ---
> include/bootguard.h | 4 ++--
> include/constants.h | 20 ++++++++++++++++++++
> include/envdata.h | 4 ++--

Valid point that the two versions of the same filename are spread out
uncleanly. But what prevents using envdata.h as a home here? I don't get
the conflict yet.

Jan
Siemens AG, Technology
Competence Center Embedded Linux

Reply all
Reply to author
Forward
0 new messages