A protocol's interface may mutate itself, but the void pointer passed to the
`{install,reinstall,uninstall}_protocol_interface` functions is opaque to the
firmware, so there's no need for it to be a mut pointer.
Note that from a Rust safety perspective there's no difference here -- mut and
const pointers are interchangeable.
https://github.com/rust-osdev/uefi-rs/issues/970
Change the allocator's `BOOT_SERVICES` static to a `SYSTEM_TABLE` containing an
`AtomicPtr`.
This completes the transition away from any uses of `static mut`.
Using a `Logger` no longer requires making it mutable, and it now provides a
`const` `new` function. This allows creating a `static` `Logger`, rather than a
`static mut` `Option<Logger>`, which allows for less `unsafe`.
The `SystemTable` type is already essentially a wrapper around a pointer, so
there's no need to wrap this return value in another pointer via `NonNull`.
There's no good reason to the UEFI version of these functions over core Rust
functions like `core::ptr::copy` and `core::ptr::write_bytes`. The safety
requirements of the `core` functions are also better documented.
Returning a bool allows both "exists" and "does not exist" to be success cases,
while properly propagating unexpected errors.
This makes it line up with the std `try_exists` method:
https://doc.rust-lang.org/std/path/struct.Path.html#method.try_exists
Also simplified the implementation to just call `open`, no need to get metadata
since `open` already returns an error if the file doesn't exist.
This reverts a small change from: https://github.com/rust-osdev/uefi-rs/pull/472
If using the library without the `alloc` feature enabled, `FileSystem` isn't
available, but you might still want access to the image's file system via the
underlying protocol.
The high-level API is still easily accessible via `FileSystem::new`.
Modify `ScopedProtocol` to check if the interface pointer is null. If it is,
then `Deref` and `DerefMut` will now panic. They are also now marked
`#[track_caller]` so that the panic location points to the caller.
Also added `get` and `get_mut` methods to get potentially-null interface data
without panicking.
Some UEFI implementations have a bug where large reads will incorrectly return
an error, so read in 1 MiB chunks to avoid that.
The `RegularFile::read` method no longer returns `Option<usize>` in error data,
since that is only useful with directory reads. Directory reads continue to use
the original unchunked read, which is fine since directory entries should be
much smaller than the chunk size.
Fixes https://github.com/rust-osdev/uefi-rs/issues/825