aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interface/efi/efi_file.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/interface/efi/efi_file.c b/src/interface/efi/efi_file.c
index 258a3ba..2ef3c57 100644
--- a/src/interface/efi/efi_file.c
+++ b/src/interface/efi/efi_file.c
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <strings.h>
#include <errno.h>
#include <wchar.h>
#include <ipxe/image.h>
@@ -75,6 +76,27 @@ static const char * efi_file_name ( struct efi_file *file ) {
}
/**
+ * Find EFI file image
+ *
+ * @v wname Filename
+ * @ret image Image, or NULL
+ */
+static struct image * efi_file_find ( const CHAR16 *wname ) {
+ char name[ wcslen ( wname ) + 1 /* NUL */ ];
+ struct image *image;
+
+ /* Find image */
+ snprintf ( name, sizeof ( name ), "%ls", wname );
+ list_for_each_entry ( image, &images, list ) {
+ if ( strcasecmp ( image->name, name ) == 0 )
+ return image;
+ }
+
+ return NULL;
+
+}
+
+/**
* Open file
*
* @v this EFI file
@@ -89,7 +111,6 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
CHAR16 *wname, UINT64 mode __unused,
UINT64 attributes __unused ) {
struct efi_file *file = container_of ( this, struct efi_file, file );
- char name[ wcslen ( wname ) + 1 /* NUL */ ];
struct efi_file *new_file;
struct image *image;
@@ -113,10 +134,9 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
}
/* Identify image */
- snprintf ( name, sizeof ( name ), "%ls", wname );
- image = find_image ( name );
+ image = efi_file_find ( wname );
if ( ! image ) {
- DBGC ( file, "EFIFILE \"%s\" does not exist\n", name );
+ DBGC ( file, "EFIFILE \"%ls\" does not exist\n", wname );
return EFI_NOT_FOUND;
}