[efi] Add error table entry for local filesystem EFI_NOT_FOUND error

Add an abbreviated "Not found" error message for an EFI_NOT_FOUND
error encountered when attempting to open a file on a local
filesystem, so that any automatic attempt to download a non-existent
autoexec.ipxe script produces only a minimal error message.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/1130/merge
Michael Brown 2024-03-29 12:41:32 +00:00
parent 19f39bc07a
commit 43deab89c3
1 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/uri.h> #include <ipxe/uri.h>
#include <ipxe/iobuf.h> #include <ipxe/iobuf.h>
#include <ipxe/process.h> #include <ipxe/process.h>
#include <ipxe/errortab.h>
#include <ipxe/efi/efi.h> #include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_strings.h> #include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_path.h> #include <ipxe/efi/efi_path.h>
@ -48,6 +49,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
* *
*/ */
/* Disambiguate the various error causes */
#define EINFO_EEFI_OPEN \
__einfo_uniqify ( EINFO_EPLATFORM, 0x01, "Could not open" )
#define EINFO_EEFI_OPEN_NOT_FOUND \
__einfo_platformify ( EINFO_EEFI_OPEN, EFI_NOT_FOUND, \
"Not found" )
#define EEFI_OPEN_NOT_FOUND \
__einfo_error ( EINFO_EEFI_OPEN_NOT_FOUND )
#define EEFI_OPEN( efirc ) EPLATFORM ( EINFO_EEFI_OPEN, efirc, \
EEFI_OPEN_NOT_FOUND )
/** Download blocksize */ /** Download blocksize */
#define EFI_LOCAL_BLKSIZE 4096 #define EFI_LOCAL_BLKSIZE 4096
@ -75,6 +87,11 @@ struct efi_local {
size_t len; size_t len;
}; };
/** Human-readable error messages */
struct errortab efi_local_errors[] __errortab = {
__einfo_errortab ( EINFO_EEFI_OPEN_NOT_FOUND ),
};
/** /**
* Free local file * Free local file
* *
@ -339,7 +356,7 @@ static int efi_local_open_resolved ( struct efi_local *local,
/* Open file */ /* Open file */
if ( ( efirc = local->root->Open ( local->root, &file, name, if ( ( efirc = local->root->Open ( local->root, &file, name,
EFI_FILE_MODE_READ, 0 ) ) != 0 ) { EFI_FILE_MODE_READ, 0 ) ) != 0 ) {
rc = -EEFI ( efirc ); rc = -EEFI_OPEN ( efirc );
DBGC ( local, "LOCAL %p could not open \"%s\": %s\n", DBGC ( local, "LOCAL %p could not open \"%s\": %s\n",
local, resolved, strerror ( rc ) ); local, resolved, strerror ( rc ) );
return rc; return rc;