multiboot2: Allow to get Custom Tags#118
Conversation
210b9e8 to
4069622
Compare
35e2e43 to
60201ba
Compare
IsaacWoods
left a comment
There was a problem hiding this comment.
Looks good! Some comments about a potential ergonomics improvement, and also some names.
| /// | ||
| /// A `SpecifiedOrCustomTagType` can be constructed from [`SpecifiedOrCustomTagTypeSerialized`]. | ||
| #[derive(Copy, Clone, Eq, Ord, PartialOrd, PartialEq, Hash)] | ||
| pub enum SpecifiedOrCustomTagType { |
There was a problem hiding this comment.
This and SpecifiedOrCustomTagTypeSerialized are quite long names. If you're alright with the breaking change, I think this being TagType and the current type being renamed to StandardTagType could work? Not sure what a better word for the Serialized bit would be but it also doesn't quite fit.
There was a problem hiding this comment.
I have an idea how I can simplify everything and have cleaner names. Let's see how it works out in the end.
There was a problem hiding this comment.
Cleaner (shorter) names would really help. I can't help but gloss over the name after the third word. ;)
There was a problem hiding this comment.
Worst offender: SpecifiedOrCustomTagTypeSerialized :-D
There was a problem hiding this comment.
I hope you like the new API more. Now there is only TagType and TagTypeId.
|
Thanks for working on this! Regarding the naming:
|
|
Regarding the API, for your example of a tag that contains a string it could look like this instead: #[repr(C, align(8))]
struct CustomTag {
name: [u8], // flexible array
}
impl Tag for CustomTag {
pub const ID: u32 = 0x1337;
}For the user the pointer handling then completely disappears. It would also take care of having to handle tag IDs manually. The only downside is that As a user I would then like to do use something like |
Impossible, as this is not I think, |
You may have to cast through a slice to get the required size information.
Are you sure? The way I understand it is that references to the |
e2dd398 to
86aad17
Compare
c2a0931 to
cb1bb2c
Compare
It feels unnecessarily overengineered to me. I'd stick with |
|
If no further comments are made, I'm going to merge this in 7 days. |
3bd61a9 to
76a8e8a
Compare
0c76d94 to
e687d17
Compare
29d5e9d to
a2af96c
Compare
e687d17 to
b09c7df
Compare
This change allows to get custom tag types.
This is my first draft to implement #116, i.e., to parse custom Multiboot2 tags.This PR allows getting custom tags from the Multiboot2 boot information.
The PR should be reviewed commit by commit. May I ask @IsaacWoods for feedback and @blitz for your opinion about the new API?
TL;DR usage:
Of course, using custom tags, brings all the pain of doing raw pointer magic to the library users.