Browse Source

[efi] Make our virtual file system case insensitive

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
2cb95c9028
1 changed files with 24 additions and 4 deletions
  1. 24
    4
      src/interface/efi/efi_file.c

+ 24
- 4
src/interface/efi/efi_file.c View File

30
 #include <stdlib.h>
30
 #include <stdlib.h>
31
 #include <stdio.h>
31
 #include <stdio.h>
32
 #include <string.h>
32
 #include <string.h>
33
+#include <strings.h>
33
 #include <errno.h>
34
 #include <errno.h>
34
 #include <wchar.h>
35
 #include <wchar.h>
35
 #include <ipxe/image.h>
36
 #include <ipxe/image.h>
74
 	return ( file->image ? file->image->name : "<root>" );
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
  * Open file
100
  * Open file
79
  *
101
  *
89
 		CHAR16 *wname, UINT64 mode __unused,
111
 		CHAR16 *wname, UINT64 mode __unused,
90
 		UINT64 attributes __unused ) {
112
 		UINT64 attributes __unused ) {
91
 	struct efi_file *file = container_of ( this, struct efi_file, file );
113
 	struct efi_file *file = container_of ( this, struct efi_file, file );
92
-	char name[ wcslen ( wname ) + 1 /* NUL */ ];
93
 	struct efi_file *new_file;
114
 	struct efi_file *new_file;
94
 	struct image *image;
115
 	struct image *image;
95
 
116
 
113
 	}
134
 	}
114
 
135
 
115
 	/* Identify image */
136
 	/* Identify image */
116
-	snprintf ( name, sizeof ( name ), "%ls", wname );
117
-	image = find_image ( name );
137
+	image = efi_file_find ( wname );
118
 	if ( ! image ) {
138
 	if ( ! image ) {
119
-		DBGC ( file, "EFIFILE \"%s\" does not exist\n", name );
139
+		DBGC ( file, "EFIFILE \"%ls\" does not exist\n", wname );
120
 		return EFI_NOT_FOUND;
140
 		return EFI_NOT_FOUND;
121
 	}
141
 	}
122
 
142
 

Loading…
Cancel
Save