mirror of https://github.com/ipxe/ipxe.git
[efi] Make our virtual file system case insensitive
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/27/merge
parent
3357a8e369
commit
2cb95c9028
|
@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <ipxe/image.h>
|
#include <ipxe/image.h>
|
||||||
|
@ -74,6 +75,27 @@ static const char * efi_file_name ( struct efi_file *file ) {
|
||||||
return ( file->image ? file->image->name : "<root>" );
|
return ( file->image ? file->image->name : "<root>" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Open file
|
||||||
*
|
*
|
||||||
|
@ -89,7 +111,6 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
|
||||||
CHAR16 *wname, UINT64 mode __unused,
|
CHAR16 *wname, UINT64 mode __unused,
|
||||||
UINT64 attributes __unused ) {
|
UINT64 attributes __unused ) {
|
||||||
struct efi_file *file = container_of ( this, struct efi_file, file );
|
struct efi_file *file = container_of ( this, struct efi_file, file );
|
||||||
char name[ wcslen ( wname ) + 1 /* NUL */ ];
|
|
||||||
struct efi_file *new_file;
|
struct efi_file *new_file;
|
||||||
struct image *image;
|
struct image *image;
|
||||||
|
|
||||||
|
@ -113,10 +134,9 @@ efi_file_open ( EFI_FILE_PROTOCOL *this, EFI_FILE_PROTOCOL **new,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Identify image */
|
/* Identify image */
|
||||||
snprintf ( name, sizeof ( name ), "%ls", wname );
|
image = efi_file_find ( wname );
|
||||||
image = find_image ( name );
|
|
||||||
if ( ! image ) {
|
if ( ! image ) {
|
||||||
DBGC ( file, "EFIFILE \"%s\" does not exist\n", name );
|
DBGC ( file, "EFIFILE \"%ls\" does not exist\n", wname );
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue