-
Notifications
You must be signed in to change notification settings - Fork 159
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
uefi-raw: unified boolean type #1307
base: main
Are you sure you want to change the base?
Conversation
So this ends up being similar to enums, where we carefully construct wrappers with |
I've come up with a new design. What do you think? Open Question:
|
I think this design looks good.
Yes, I think loosening the requirements so that any non-zero value is treated as
I feel that it does. For example, with the field In this particular case, I think the easiest thing to do is to change the definition to |
ab54a33
to
483dee0
Compare
This way we can be ABI-compatible and guarantee lack of UB, while being more precise in interfaces.
fed3cee
to
95e4c16
Compare
This aligns the behaviour with r_efi [0]. [0] https://docs.rs/r-efi/5.1.0/src/r_efi/base.rs.html#488
@@ -23,5 +23,9 @@ bitflags.workspace = true | |||
ptr_meta.workspace = true | |||
uguid.workspace = true | |||
|
|||
[features] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no error type in uefi-raw now, so I think the features
section can be dropped
|
||
# uefi-raw - 0.8.0 (2024-09-09) | ||
|
||
## Added | ||
|
||
- Added `PAGE_SIZE` constant. | ||
|
||
- Added a new `unstable` feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed
assert_eq!(Boolean::FALSE.0, 0); | ||
assert_eq!(bool::from(Boolean(0b0)), false); | ||
assert_eq!(bool::from(Boolean(0b1)), true); | ||
// We do it a C: Every bit pattern not 0 is equal to true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// We do it a C: Every bit pattern not 0 is equal to true | |
// We do it as in C: Every bit pattern not 0 is equal to true |
- Fixed `boot::open_protocol` to properly handle a null interface pointer. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tiny nit: per your changes in 4d1906e, two blank lines between each version entry
pub const fn cursor_visible(&self) -> bool { | ||
self.data().cursor_visible | ||
pub fn cursor_visible(&self) -> bool { | ||
// Panic: Misbehaving UEFI impls are so unlikely; just fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop the panic comment now that conversion cannot fail
pub const fn is_removable_media(&self) -> bool { | ||
self.0.removable_media | ||
pub fn is_removable_media(&self) -> bool { | ||
// Panic: Misbehaving UEFI impls are so unlikely; just fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can drop all the panic comments in this file too
@@ -31,6 +31,7 @@ enum ErrorKind { | |||
ForbiddenType, | |||
MalformedAttrs, | |||
MissingPub, | |||
MissingRepr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check_raw
changes can all be dropped since there's no error type anymore.
@@ -15,9 +15,9 @@ details of the deprecated items that were removed in this release. | |||
- **Breaking:** `FileSystem` no longer has a lifetime parameter, and the | |||
deprecated conversion from `uefi::table::boot::ScopedProtocol` has been | |||
removed. | |||
- **Breaking:** Removed `BootPolicyError` as `BootPolicy` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **Breaking:** Removed `BootPolicyError` as `BootPolicy` | |
- **Breaking:** Removed `BootPolicyError` as `BootPolicy` construction is no longer fallible. |
This streamlines the existing usages of
u8
andbool
. Note thatBootPolicy
from #1297 is seamlessly integrated intou8
andbool
.Steps to Undraft
Checklist