diff options
author | peter <peter@FreeBSD.org> | 2002-03-19 23:05:33 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-03-19 23:05:33 +0000 |
commit | 84239ef763b47e20b2617edffca1d5144397849e (patch) | |
tree | 9d0dfc05e7de1519ec50def1c8613563fcb5018d | |
parent | f36956581759863bfd4e05c77c234e512834ebd4 (diff) | |
download | FreeBSD-src-84239ef763b47e20b2617edffca1d5144397849e.zip FreeBSD-src-84239ef763b47e20b2617edffca1d5144397849e.tar.gz |
Add EFI write support to loader
-rw-r--r-- | sys/boot/efi/libefi/efifs.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sys/boot/efi/libefi/efifs.c b/sys/boot/efi/libefi/efifs.c index c1eaecf..e459881 100644 --- a/sys/boot/efi/libefi/efifs.c +++ b/sys/boot/efi/libefi/efifs.c @@ -129,7 +129,35 @@ efifs_read(struct open_file *f, void *buf, size_t size, size_t *resid) size -= sz; bufp += sz; } - *resid = size; + if (resid) + *resid = size; + return 0; +} + +static int +efifs_write(struct open_file *f, void *buf, size_t size, size_t *resid) +{ + EFI_FILE *file = f->f_fsdata; + EFI_STATUS status; + UINTN sz = size; + char *bufp; + + bufp = buf; + while (size > 0) { + sz = size; + if (sz > 8192) + sz = 8192; + status = file->Write(file, &sz, bufp); + twiddle(); + if (EFI_ERROR(status)) + return EIO; + if (sz == 0) + break; + size -= sz; + bufp += sz; + } + if (resid) + *resid = size; return 0; } @@ -246,7 +274,7 @@ struct fs_ops efi_fsops = { efifs_open, efifs_close, efifs_read, - null_write, + efifs_write, efifs_seek, efifs_stat, efifs_readdir |