[Libguestfs] [PATCH v6 08/41] common/utils: Move ‘uefi.c’ to ‘lib/’.

Richard W.M. Jones
Thu, 15 Jun 2017 17:05:58 -0000

This was only used inside the library, so move it there.
---
 .gitignore                               |  2 +-
 common/utils/Makefile.am                 |  4 +---
 common/utils/guestfs-internal-frontend.h | 12 ------------
 docs/C_SOURCE_FILES                      |  2 +-
 generator/UEFI.ml                        |  3 ++-
 generator/main.ml                        |  2 +-
 lib/Makefile.am                          |  3 ++-
 lib/appliance-uefi.c                     |  2 +-
 lib/guestfs-internal.h                   | 12 ++++++++++++
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/.gitignore b/.gitignore
index 97fe2f050..e0dbe280c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,7 +141,6 @@ Makefile.in
 /common/utils/structs-cleanup.c
 /common/utils/structs-print.c
 /common/utils/structs-print.h
-/common/utils/uefi.c
 /compile
 /config.cache
 /config.guess
@@ -341,6 +340,7 @@ Makefile.in
 /lib/structs-copy.c
 /lib/structs-free.c
 /lib/unit-tests
+/lib/uefi.c
 /libguestfs.spec
 /libguestfs-*.tar.gz
 /libtool
diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am
index 485909bbe..47a4186d7 100644
--- a/common/utils/Makefile.am
+++ b/common/utils/Makefile.am
@@ -21,8 +21,7 @@ generator_built = \
 	guestfs-internal-frontend-cleanups.h \
 	structs-cleanup.c \
 	structs-print.c \
-	structs-print.h \
-	uefi.c
+	structs-print.h

 BUILT_SOURCES = \
 	$(generator_built)
@@ -39,7 +38,6 @@ libutils_la_SOURCES = \
 	structs-cleanup.c \
 	structs-print.c \
 	structs-print.h \
-	uefi.c \
 	utils.c
 libutils_la_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
diff --git a/common/utils/guestfs-internal-frontend.h
b/common/utils/guestfs-internal-frontend.h
index dacc92e49..92c9ae902 100644
--- a/common/utils/guestfs-internal-frontend.h
+++ b/common/utils/guestfs-internal-frontend.h
@@ -71,18 +71,6 @@ extern void guestfs_int_fadvise_noreuse (int fd);
 extern char *guestfs_int_shell_unquote (const char *str);
 extern void guestfs_int_cleanup_free_string_list (char ***ptr);

-/* uefi.c */
-struct uefi_firmware {
-  const char *code;		/* code file (NULL = end of list) */
-  const char *code_debug;	/* code file with debugging msgs (may be NULL)*/
-  const char *vars;		/* vars template file */
-  int flags;                    /* various flags, see below */
-#define UEFI_FLAG_SECURE_BOOT_REQUIRED 1 /* secure boot (see RHBZ#1367615) */
-};
-extern struct uefi_firmware guestfs_int_uefi_i386_firmware[];
-extern struct uefi_firmware guestfs_int_uefi_x86_64_firmware[];
-extern struct uefi_firmware guestfs_int_uefi_aarch64_firmware[];
-
 /* These are in a separate header so the header can be generated.
  * Don't include the following file directly:
  */
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index ceed9581d..0ba99e259 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -51,7 +51,6 @@ common/utils/guestfs-internal-frontend.h
 common/utils/structs-cleanup.c
 common/utils/structs-print.c
 common/utils/structs-print.h
-common/utils/uefi.c
 common/utils/utils.c
 common/visit/visit.c
 common/visit/visit.h
@@ -333,6 +332,7 @@ lib/structs-copy.c
 lib/structs-free.c
 lib/tmpdirs.c
 lib/tsk.c
+lib/uefi.c
 lib/umask.c
 lib/unit-tests.c
 lib/version.c
diff --git a/generator/UEFI.ml b/generator/UEFI.ml
index 5c5e02bab..17418f473 100644
--- a/generator/UEFI.ml
+++ b/generator/UEFI.ml
@@ -86,7 +86,8 @@ let generate_uefi_c ()    pr "\n";
   pr "#include <stdio.h>\n";
   pr "\n";
-  pr "#include \"guestfs-internal-frontend.h\"\n";
+  pr "#include \"guestfs.h\"\n";
+  pr "#include \"guestfs-internal.h\"\n";

   List.iter (
     fun arch ->
diff --git a/generator/main.ml b/generator/main.ml
index 0e1c01f74..8ff698130 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -94,7 +94,7 @@ Run it from the top source directory using the command
             C.generate_client_structs_print_c;
   output_to "common/utils/structs-print.h"
             C.generate_client_structs_print_h;
-  output_to "common/utils/uefi.c"
+  output_to "lib/uefi.c"
             UEFI.generate_uefi_c;
   output_to "lib/guestfs.h"
             C.generate_guestfs_h;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 90c657514..12fdbcd6c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -124,10 +124,11 @@ libguestfs_la_SOURCES = \
 	structs-free.c \
 	tmpdirs.c \
 	tsk.c \
+	uefi.c \
 	umask.c \
+	version.c \
 	wait.c \
 	whole-file.c \
-	version.c \
 	yara.c \
 	libguestfs.syms

diff --git a/lib/appliance-uefi.c b/lib/appliance-uefi.c
index 1612c5db5..986989e67 100644
--- a/lib/appliance-uefi.c
+++ b/lib/appliance-uefi.c
@@ -19,7 +19,7 @@
 /**
  * Find the UEFI firmware needed to boot the appliance.
  *
- * See also F<common/utils/uefi.c> (autogenerated file) containing the
+ * See also F<lib/uefi.c> (autogenerated file) containing the
  * firmware file locations.
  */

diff --git a/lib/guestfs-internal.h b/lib/guestfs-internal.h
index ec70336e2..190b5cdd2 100644
--- a/lib/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -1011,4 +1011,16 @@ extern bool guestfs_int_version_cmp_ge (const struct
version *a, const struct ve
 #define version_init_null(v) guestfs_int_version_from_values (v, 0, 0, 0)
 #define version_is_null(v) ((v)->v_major == 0 && (v)->v_minor ==
0 && (v)->v_micro == 0)

+/* uefi.c */
+struct uefi_firmware {
+  const char *code;		/* code file (NULL = end of list) */
+  const char *code_debug;	/* code file with debugging msgs (may be NULL)*/
+  const char *vars;		/* vars template file */
+  int flags;                    /* various flags, see below */
+#define UEFI_FLAG_SECURE_BOOT_REQUIRED 1 /* secure boot (see RHBZ#1367615) */
+};
+extern struct uefi_firmware guestfs_int_uefi_i386_firmware[];
+extern struct uefi_firmware guestfs_int_uefi_x86_64_firmware[];
+extern struct uefi_firmware guestfs_int_uefi_aarch64_firmware[];
+
 #endif /* GUESTFS_INTERNAL_H_ */
--
2.13.0