On Fri, Dec 02, 2022 at 01:44:08PM +0100, Laszlo Ersek wrote:
So that Windows conversion can use the same function.
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=2149629
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
lib/utils.mli | 5 +++++
convert/convert_linux.ml | 6 ------
lib/utils.ml | 5 +++++
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/lib/utils.mli b/lib/utils.mli
index d431e21f5ce9..5687bf75867e 100644
--- a/lib/utils.mli
+++ b/lib/utils.mli
@@ -98,3 +98,8 @@ val get_disk_allocated : dir:string -> disknr:int -> int64
option
image, according to the "base:allocation" metadata context. If the
context
is not supported by the NBD server behind the socket, the function returns
None. *)
+
+val get_uefi_arch_suffix : string -> string option
+(** [get_uefi_arch_suffix arch] maps [arch] from [inspect.i_arch] representation
+ to UEFI spec representation. If a mapping cannot be found, [None] is
+ returned. *)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 5bfdac5aa6d9..cde3b037542f 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -1327,12 +1327,6 @@ let convert (g : G.guestfs) source inspect keep_serial_console _
=
info (f_"Can't fix UEFI bootloader. VM may not boot.")
in
- let get_uefi_arch_suffix = function
- | "x86_64" -> Some "X64"
- | "i386" -> Some "X32"
- | _ -> None
- in
-
match get_uefi_arch_suffix inspect.i_arch with
| None -> cant_fix_uefi ()
| Some suffix -> (
diff --git a/lib/utils.ml b/lib/utils.ml
index fd45769415c7..26e7e259001b 100644
--- a/lib/utils.ml
+++ b/lib/utils.ml
@@ -258,3 +258,8 @@ let get_disk_allocated ~dir ~disknr =
Some !allocated
) else None
)
+
+let get_uefi_arch_suffix = function
+ | "x86_64" -> Some "X64"
+ | "i386" -> Some "X32"
+ | _ -> None
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW