efivar/0086-Make-declaring-efi_time_t-conditional-on-EFIVAR_NO_E.patch

58 lines
1.8 KiB
Diff
Raw Normal View History

From a9ad43032acfcd8c69cd8ca651b532fac9d28847 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 19 Feb 2020 09:57:44 -0500
Subject: [PATCH 86/86] Make declaring efi_time_t conditional on
EFIVAR_NO_EFI_TIME_T
This allows you to turn off declaration of efi_time_t and related
functions in the case where it's declared someplace else, such as in
some local code or another library's headers.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/include/efivar/efivar-time.h | 6 +++++-
src/include/efivar/efivar-types.h | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/include/efivar/efivar-time.h b/src/include/efivar/efivar-time.h
index 04c243601f5..ebe2a703ed4 100644
--- a/src/include/efivar/efivar-time.h
+++ b/src/include/efivar/efivar-time.h
@@ -4,8 +4,12 @@
* Copyright 2020 Peter Jones <pjones@redhat.com>
*/
+#if defined(EFIVAR_NO_EFI_TIME_T) && EFIVAR_NO_EFI_TIME_T && !defined(EFIVAR_TIME_H_)
+#define EFIVAR_TIME_H_ 1
+#endif
+
#ifndef EFIVAR_TIME_H_
-#define EFIVAR_TIME_H_
+#define EFIVAR_TIME_H_ 1
#include <stdbool.h>
diff --git a/src/include/efivar/efivar-types.h b/src/include/efivar/efivar-types.h
index ce22b6c12b3..ebba511b17b 100644
--- a/src/include/efivar/efivar-types.h
+++ b/src/include/efivar/efivar-types.h
@@ -51,6 +51,7 @@ typedef uint16_t efi_char16_t;
typedef unsigned long uintn_t;
typedef long intn_t;
+#if !defined(EFIVAR_NO_EFI_TIME_T) || EFIVAR_NO_EFI_TIME_T
#define EFIVAR_HAVE_EFI_TIME_T 1
/*
@@ -83,6 +84,7 @@ typedef struct {
#define EFI_TIME_IN_DAYLIGHT ((uint8_t)0x02)
#define EFI_UNSPECIFIED_TIMEZONE ((uint16_t)0x07ff)
+#endif /* !defined(EFIVAR_NO_EFI_TIME_T) || EFIVAR_NO_EFI_TIME_T */
#define EFI_VARIABLE_NON_VOLATILE ((uint64_t)0x0000000000000001)
#define EFI_VARIABLE_BOOTSERVICE_ACCESS ((uint64_t)0x0000000000000002)
--
2.24.1