[PATCH v1 4/6] lib/efi: Move magic to implementation

Geoff Levand geoff at infradead.org
Sat Aug 11 03:29:15 AEST 2018


efi_check_mount now does a magic number check by default, so
move the magic number related code from efivar.h to efivar.c.

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 lib/efi/efivar.c | 5 +++++
 lib/efi/efivar.h | 6 ------
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/efi/efivar.c b/lib/efi/efivar.c
index f1dd002..37bb6d9 100644
--- a/lib/efi/efivar.c
+++ b/lib/efi/efivar.c
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include <linux/fs.h>
+#include <linux/magic.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/statfs.h>
@@ -32,6 +33,10 @@
 #include "log/log.h"
 #include "talloc/talloc.h"
 
+#ifndef EFIVARFS_MAGIC
+#define EFIVARFS_MAGIC 0xde5e81e4
+#endif
+
 void efi_init_mount(struct efi_mount *efi_mount, const char *path,
 	const char *guid)
 {
diff --git a/lib/efi/efivar.h b/lib/efi/efivar.h
index b74ab64..9307d6c 100644
--- a/lib/efi/efivar.h
+++ b/lib/efi/efivar.h
@@ -22,8 +22,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-#include <linux/magic.h>
-
 #define EFI_VARIABLE_NON_VOLATILE                           0x00000001
 #define EFI_VARIABLE_BOOTSERVICE_ACCESS                     0x00000002
 #define EFI_VARIABLE_RUNTIME_ACCESS                         0x00000004
@@ -38,10 +36,6 @@
 	EFI_VARIABLE_BOOTSERVICE_ACCESS \
 )
 
-#ifndef EFIVARFS_MAGIC
-#define EFIVARFS_MAGIC 0xde5e81e4
-#endif
-
 struct efi_data {
 	uint32_t attributes;
 	size_t data_size;
-- 
2.14.1




More information about the Petitboot mailing list