summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2024-03-29 13:41:32 +0100
committerMichael Brown2024-03-29 15:46:13 +0100
commit43deab89c329984366d519ae612b67ee0d5998b6 (patch)
tree4b7993921f2bca38ecca0b070f6851596e2d14b8
parent[efi] Report local file errors during download, rather than on opening (diff)
downloadipxe-43deab89c329984366d519ae612b67ee0d5998b6.tar.gz
ipxe-43deab89c329984366d519ae612b67ee0d5998b6.tar.xz
ipxe-43deab89c329984366d519ae612b67ee0d5998b6.zip
[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>
-rw-r--r--src/interface/efi/efi_local.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/interface/efi/efi_local.c b/src/interface/efi/efi_local.c
index 00cc1147..ec6d93a1 100644
--- a/src/interface/efi/efi_local.c
+++ b/src/interface/efi/efi_local.c
@@ -35,6 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/uri.h>
#include <ipxe/iobuf.h>
#include <ipxe/process.h>
+#include <ipxe/errortab.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_strings.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 */
#define EFI_LOCAL_BLKSIZE 4096
@@ -75,6 +87,11 @@ struct efi_local {
size_t len;
};
+/** Human-readable error messages */
+struct errortab efi_local_errors[] __errortab = {
+ __einfo_errortab ( EINFO_EEFI_OPEN_NOT_FOUND ),
+};
+
/**
* Free local file
*
@@ -339,7 +356,7 @@ static int efi_local_open_resolved ( struct efi_local *local,
/* Open file */
if ( ( efirc = local->root->Open ( local->root, &file, name,
EFI_FILE_MODE_READ, 0 ) ) != 0 ) {
- rc = -EEFI ( efirc );
+ rc = -EEFI_OPEN ( efirc );
DBGC ( local, "LOCAL %p could not open \"%s\": %s\n",
local, resolved, strerror ( rc ) );
return rc;