OSDN Git Service

Simplify our include files
authorPeter Jones <pjones@redhat.com>
Thu, 17 May 2018 20:31:59 +0000 (16:31 -0400)
committerPeter Jones <pmjones@gmail.com>
Mon, 21 May 2018 13:27:22 +0000 (09:27 -0400)
Make everything just include src/efivar.h or src/efiboot.h, and let
those sort out the correct things to include.

Signed-off-by: Peter Jones <pjones@redhat.com>
22 files changed:
src/creator.c
src/disk.c
src/dp-acpi.c
src/dp-hw.c
src/dp-media.c
src/dp-message.c
src/dp.c
src/efiboot.h [new file with mode: 0644]
src/efivar.c
src/efivar.h [new file with mode: 0644]
src/efivarfs.c
src/error.c
src/export.c
src/generics.h
src/gpt.c
src/guid.c
src/lib.c
src/lib.h
src/linux.c
src/loadopt.c
src/makeguids.c
src/vars.c

index 79bf514..e9bea22 100644 (file)
 #include <sys/stat.h>
 #include <sys/socket.h>
 
-#include <efivar/efivar.h>
-#include <efivar/efiboot.h>
-
-#include "disk.h"
-#include "dp.h"
-#include "linux.h"
-#include "util.h"
+#include "efiboot.h"
 
 static int
 __attribute__((__nonnull__ (1,2,3)))
index 63838ce..c8fd419 100644 (file)
 #include <sys/utsname.h>
 #include <unistd.h>
 
-#include <efivar/efivar.h>
-#include <efivar/efiboot.h>
-
-#include "util.h"
-#include "crc32.h"
-#include "disk.h"
-#include "gpt.h"
+#include "efiboot.h"
 
 /**
  * is_mbr_valid(): test MBR for validity
index ff3631c..9611e73 100644 (file)
@@ -25,8 +25,7 @@
 #include <stdarg.h>
 #include <stddef.h>
 
-#include <efivar/efivar.h>
-#include "dp.h"
+#include "efivar.h"
 
 static ssize_t
 _format_acpi_adr(char *buf, size_t size,
index 4ddb6c8..f991409 100644 (file)
@@ -23,8 +23,7 @@
 #include <errno.h>
 #include <inttypes.h>
 
-#include <efivar/efivar.h>
-#include "dp.h"
+#include "efivar.h"
 
 ssize_t
 format_edd10_guid(char *buf, size_t size, const char *dp_type, const_efidp dp)
index 204fc70..7095c48 100644 (file)
@@ -25,8 +25,7 @@
 #include <stdarg.h>
 #include <stddef.h>
 
-#include <efivar/efivar.h>
-#include "dp.h"
+#include "efivar.h"
 
 ssize_t
 _format_media_dn(char *buf, size_t size, const_efidp dp)
index 8f3b6d6..b32d590 100644 (file)
@@ -25,9 +25,7 @@
 #include <inttypes.h>
 #include <stddef.h>
 
-#include <efivar/efivar.h>
-#include "efivar_endian.h"
-#include "dp.h"
+#include "efivar.h"
 
 static ssize_t
 format_ipv4_addr_helper(char *buf, size_t size, const char *dp_type,
index f988289..bbf3681 100644 (file)
--- a/src/dp.c
+++ b/src/dp.c
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include <efivar/efivar.h>
-#include "dp.h"
-#include "util.h"
+#include "efivar.h"
 
 static const efidp_header end_entire = {
        .type = EFIDP_END_TYPE,
diff --git a/src/efiboot.h b/src/efiboot.h
new file mode 100644 (file)
index 0000000..f60f2cf
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * efiboot.h
+ * Copyright 2018 Peter Jones <pjones@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PRIVATE_EFIBOOT_H_
+#define PRIVATE_EFIBOOT_H_
+
+#include "efivar.h"
+#include <efivar/efiboot.h>
+
+#endif /* !PRIVATE_EFIBOOT_H_ */
+// vim:fenc=utf-8:tw=75:et
index 5adaa51..9ee3b39 100644 (file)
@@ -37,8 +37,7 @@
 extern char *optarg;
 extern int optind, opterr, optopt;
 
-#include <efivar/efivar.h>
-#include "guid.h"
+#include "efivar.h"
 
 #define ACTION_LIST            0x1
 #define ACTION_PRINT           0x2
diff --git a/src/efivar.h b/src/efivar.h
new file mode 100644 (file)
index 0000000..eec4550
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * efivar.h
+ * Copyright 2018 Peter Jones <pjones@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PRIVATE_EFIVAR_H_
+#define PRIVATE_EFIVAR_H_
+
+#include <efivar/efivar.h>
+
+#include "util.h"
+#include "efivar_endian.h"
+#include "lib.h"
+#include "guid.h"
+#include "generics.h"
+#include "dp.h"
+#include "gpt.h"
+#include "disk.h"
+#include "linux.h"
+#include "crc32.h"
+
+#endif /* !PRIVATE_EFIVAR_H_ */
+// vim:fenc=utf-8:tw=75:et
index 2b1aada..e5f8d86 100644 (file)
@@ -33,9 +33,7 @@
 #include <sys/vfs.h>
 #include <unistd.h>
 
-#include "lib.h"
-#include "generics.h"
-#include "util.h"
+#include "efivar.h"
 
 #include <linux/fs.h>
 
index 3e55c5c..d7546ff 100644 (file)
@@ -28,6 +28,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "efiboot.h"
+
 /*
  * GCC/Clang complains that we check for null if we have a nonnull attribute,
  * even though older or other compilers might just ignore that attribute if
index ae2a1e3..7e0b1a0 100644 (file)
@@ -25,8 +25,7 @@
 #include <stdlib.h>
 #include <uchar.h>
 
-#include <efivar/efivar.h>
-#include "lib.h"
+#include "efivar.h"
 
 #define EFIVAR_MAGIC 0xf3df1597
 
index fdd9f85..1234bab 100644 (file)
@@ -29,8 +29,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "guid.h"
-
 static DIR *dir;
 
 static inline int
index 5fe10ec..0ab315d 100644 (file)
--- a/src/gpt.c
+++ b/src/gpt.c
 #include <sys/utsname.h>
 #include <unistd.h>
 
-#include <efivar/efivar.h>
-
-#include "crc32.h"
-#include "disk.h"
-#include "gpt.h"
-#include "util.h"
-#include "efivar_endian.h"
+#include "efivar.h"
 
 #ifndef BLKGETLASTSECT
 #define BLKGETLASTSECT _IO(0x12,108) /* get last sector of block device */
index 2b4d0f8..514c916 100644 (file)
@@ -24,8 +24,7 @@
 #include <errno.h>
 #include <stdio.h>
 
-#include <efivar/efivar.h>
-#include "guid.h"
+#include "efivar.h"
 
 #define GUID_LENGTH_WITH_NUL 37
 
index 8f85c71..fcaf6b5 100644 (file)
--- a/src/lib.c
+++ b/src/lib.c
@@ -28,9 +28,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include <efivar/efivar.h>
-#include "lib.h"
-#include "generics.h"
+#include "efivar.h"
 
 static int default_probe(void)
 {
index bc08c82..5024128 100644 (file)
--- a/src/lib.h
+++ b/src/lib.h
@@ -21,8 +21,6 @@
 #ifndef LIBEFIVAR_LIB_H
 #define LIBEFIVAR_LIB_H 1
 
-#include <efivar/efivar.h>
-
 #include <dirent.h>
 #include <limits.h>
 
index b445cf8..d3cca1c 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include <efivar/efivar.h>
-#include <efivar/efiboot.h>
-
-#include "dp.h"
-#include "linux.h"
-#include "util.h"
+#include "efiboot.h"
 
 int
 __attribute__((__visibility__ ("hidden")))
index ed79899..ba25474 100644 (file)
 
 #include "fix_coverity.h"
 
-#include <efivar/efivar.h>
 #include <stddef.h>
 
-#include "dp.h"
+#include "efiboot.h"
 #include "include/efivar/efiboot-loadopt.h"
 
 typedef struct efi_load_option_s {
index 9bf7a16..f84fbb8 100644 (file)
@@ -27,9 +27,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <efivar/efivar.h>
-#include "util.h"
-#include "guid.h"
+#include "efivar.h"
 
 efi_guid_t const efi_guid_zero = {0};
 efi_guid_t const efi_guid_empty = {0};
index e647772..c1432c3 100644 (file)
@@ -31,9 +31,7 @@
 #include <sys/types.h>
 #include <sys/utsname.h>
 
-#include "lib.h"
-#include "generics.h"
-#include "util.h"
+#include "efivar.h"
 
 static const char default_vars_path[] = "/sys/firmware/efi/vars/";