Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional error data in Result + some API cleanup and clarification #78

Merged
merged 11 commits into from Jan 4, 2019

Conversation

HadrienG2
Copy link
Contributor

@HadrienG2 HadrienG2 commented Jan 3, 2019

This PR fixes #70 by adding support for additional error data to our Result type. As a result, usage of raw core::result::Result can now be restricted to functions which do not call into UEFI.

Since most functions do not return additional error data, the associated type parameter is optional with a default of (). After some thought, I think that the main output should probably get the same treatment, as a large amount of "setter" UEFI functions do not emit anything more than a status code.

While I went around the codebase to tweak every API entry point definition accordingly, I noticed a couple of issues here and there. Some entry points were in minor disagreement with the spec's semantics, while others did something wrong and dangerous. I'll clarify those changes as PR comments.

As I noticed some lifetime errors among these, I thought now might be a good time to use clearer lifetime parameter names in order to clarify the semantics of lifetime-based code. Result's generic parameters also got the same treatment.

src/proto/console/serial.rs Show resolved Hide resolved
src/proto/console/text/output.rs Show resolved Hide resolved
src/proto/console/text/output.rs Outdated Show resolved Hide resolved
src/proto/media/file/dir.rs Show resolved Hide resolved
src/proto/media/file/mod.rs Show resolved Hide resolved
uefi-exts/src/boot.rs Show resolved Hide resolved
src/table/boot.rs Show resolved Hide resolved
src/prelude.rs Show resolved Hide resolved
src/result/error.rs Show resolved Hide resolved
src/result/status.rs Show resolved Hide resolved
Copy link
Collaborator

@GabrielMajeri GabrielMajeri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the improvements to the error types. While these changes are extensive, it should be better in the long run.

@HadrienG2
Copy link
Contributor Author

I try to do this kind of API changes now so that we don't have to do them later, as the more UEFI entry points we have the more painful this exercise becomes (not to mention the impact on users, when we have more of them). It is also a good way for me to become more familiar with your work.

Next things I'd like to work on:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maybe uefi::Result should allow for custom errors
2 participants