|
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
30
|
30
|
#include <stdlib.h>
|
31
|
31
|
#include <stdio.h>
|
32
|
32
|
#include <string.h>
|
|
33
|
+#include <strings.h>
|
33
|
34
|
#include <errno.h>
|
34
|
35
|
#include <wchar.h>
|
35
|
36
|
#include <ipxe/image.h>
|
|
@@ -74,6 +75,27 @@ static const char * efi_file_name ( struct efi_file *file ) {
|
74
|
75
|
return ( file->image ? file->image->name : "<root>" );
|
75
|
76
|
}
|
76
|
77
|
|
|
78
|
+/**
|
|
79
|
+ * Find EFI file image
|
|
80
|
+ *
|
|
81
|
+ * @v wname Filename
|
|
82
|
+ * @ret image Image, or NULL
|
|
83
|
+ */
|
|
84
|
+static struct image * efi_file_find ( const CHAR16 *wname ) {
|
|
85
|
+ char name[ wcslen ( wname ) + 1 /* NUL */ ];
|
|
86
|
+ struct image *image;
|
|
87
|
+
|
|
88
|
+ /* Find image */
|
|
89
|
+ snprintf ( name, sizeof ( name ), "%ls", wname );
|
|
90
|
+ list_for_each_entry ( image, &images, list ) {
|
|
91
|
+ if ( strcasecmp ( image->name, name ) == 0 )
|
|
92
|
+ return image;
|
|
93
|
+ }
|
|
94
|
+
|
|
95
|
+ return NULL;
|
|
96
|
+
|
|
97
|
+}
|
|
98
|
+
|
77
|
99
|
/**
|
78
|
100
|
* Open file
|
79
|
101
|
*
|
|
@@ -89,7 +111,6 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
|
89
|
111
|
CHAR16 *wname, UINT64 mode __unused,
|
90
|
112
|
UINT64 attributes __unused ) {
|
91
|
113
|
struct efi_file *file = container_of ( this, struct efi_file, file );
|
92
|
|
- char name[ wcslen ( wname ) + 1 /* NUL */ ];
|
93
|
114
|
struct efi_file *new_file;
|
94
|
115
|
struct image *image;
|
95
|
116
|
|
|
@@ -113,10 +134,9 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
|
113
|
134
|
}
|
114
|
135
|
|
115
|
136
|
/* Identify image */
|
116
|
|
- snprintf ( name, sizeof ( name ), "%ls", wname );
|
117
|
|
- image = find_image ( name );
|
|
137
|
+ image = efi_file_find ( wname );
|
118
|
138
|
if ( ! image ) {
|
119
|
|
- DBGC ( file, "EFIFILE \"%s\" does not exist\n", name );
|
|
139
|
+ DBGC ( file, "EFIFILE \"%ls\" does not exist\n", wname );
|
120
|
140
|
return EFI_NOT_FOUND;
|
121
|
141
|
}
|
122
|
142
|
|