summaryrefslogtreecommitdiff
path: root/stand/uboot
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-03-08 17:42:42 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-03-08 17:42:42 +0000
commitafc571b1a6fb341b0e3f603d4f3a2538093e91f5 (patch)
treea446172ecf9eb86977386f59f06ecfdd1bc7b1b2 /stand/uboot
parent601ee53858f61e7a130dc2e306202b5297626d25 (diff)
downloadsrc-test-afc571b1a6fb341b0e3f603d4f3a2538093e91f5.tar.gz
src-test-afc571b1a6fb341b0e3f603d4f3a2538093e91f5.zip
veloader use vectx API for kernel and modules
The vectx API, computes the hash for verifying a file as it is read. This avoids the overhead of reading files twice - once to verify, then again to load. For doing an install via loader, avoiding the need to rewind large files is critical. This API is only used for modules, kernel and mdimage as these are the biggest files read by the loader. The reduction in boot time depends on how expensive the I/O is on any given platform. On a fast VM we see 6% improvement. For install via loader the first file to be verified is likely to be the kernel, so some of the prep work (finding manifest etc) done by verify_file() needs to be factored so it can be reused for vectx_open(). For missing or unrecognized fingerprint entries, we fail in vectx_open() unless verifying is disabled. Otherwise fingerprint check happens in vectx_close() and since this API is only used for files which must be verified (VE_MUST) we panic if we get an incorrect hash. Reviewed by: imp,tsoome MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D23827
Notes
Notes: svn path=/head/; revision=358744
Diffstat (limited to 'stand/uboot')
-rw-r--r--stand/uboot/lib/copy.c4
-rw-r--r--stand/uboot/lib/libuboot.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/stand/uboot/lib/copy.c b/stand/uboot/lib/copy.c
index 7fd5fd671c022..65451d0fbec04 100644
--- a/stand/uboot/lib/copy.c
+++ b/stand/uboot/lib/copy.c
@@ -160,7 +160,7 @@ uboot_copyout(const vm_offset_t src, void *dest, const size_t len)
}
ssize_t
-uboot_readin(const int fd, vm_offset_t dest, const size_t len)
+uboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len)
{
- return (read(fd, (void *)dest, len));
+ return (VECTX_READ(fd, (void *)dest, len));
}
diff --git a/stand/uboot/lib/libuboot.h b/stand/uboot/lib/libuboot.h
index 59438e711a652..18a12c216d7eb 100644
--- a/stand/uboot/lib/libuboot.h
+++ b/stand/uboot/lib/libuboot.h
@@ -28,6 +28,7 @@
*/
#include <disk.h>
+#include <readin.h>
struct uboot_devdesc {
union {
@@ -62,7 +63,7 @@ extern uintptr_t uboot_heap_end;
uint64_t uboot_loadaddr(u_int type, void *data, uint64_t addr);
ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len);
ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len);
-ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len);
+ssize_t uboot_readin(readin_handle_t fd, vm_offset_t dest, const size_t len);
extern int uboot_autoload(void);
struct preloaded_file;