Improve device path API #421
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an update to the device path API with two goals:
instances, and device path nodes by using different types.
-Zmiri-tag-raw-pointers
enabledIn the UEFI spec, the
EFI_DEVICE_PATH_PROTOCOL
struct is used torepresent both full paths and individual nodes. Prior to this commit,
DevicePath
was used the same way. This didn't make for the clearestAPI though, since the distinction between paths and nodes mainly existed
in the documentation rather than the type system. To solve this, there
are now three main types:
DevicePath
,DevicePathInstance
, andDevicePathNode
.In addition, since
DevicePath
was only four bytes in size (i.e. thesize of the node header), Miri was unhappy when bytes were read past
those four bytes. The solution is to use DSTs that cover the appropriate
span of bytes. This required the addition of a new
ProtocolPointer
trait so that when a DST protocol is opened, a fat pointer can be
constructed from the thin
c_void
pointer.The
device_path
module's docstring has been expanded quite a bit todescribe how all the types fit together.
This commit enables
-Zmiri-tag-raw-pointers
, so:Fixes #414