-
Notifications
You must be signed in to change notification settings - Fork 88
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
Replace AsSliceU8
trait with zerocopy::AsBytes
#692
Comments
Hi @mkroening! @scotran and I are part of a Virtualization course at UT Austin, and as part of a project we have to contribute to open source repositories. Can we take up this issue? |
Sure, do you want to do all three issues? PS: To assign @scotran, he has to be a participant of this issue. Just write anything, then I can add him as well. |
Yep, all three issues would be great! |
Hi @mkroening! I was able to switch the VirtioNetHdr (currently reflected in the pull request created) from implementing AsSliceU8 to deriving AsBytes, but I ran into an issue when trying to change from AsSliceU8 to AsBytes for the Cmd and Rsp structs (https://github.com/hermitcore/libhermit-rs/blob/master/src/fs/fuse.rs#L293): #[derive(AsBytes)] is not supported on types with type parameters. Digging around, there seems to be a workaround (google/zerocopy#10), but this would require using repr(transparent), which then cannot be used alongside repr(C) or repr(packed), which would strip padding and possibly cause alignment issue. I just wanted to touch base first as to whether this would be the desired approach, and if so, I can continue looking into how to derive AsBytes for structs with type parameters. |
Changed VirtioNetHdr to derive from AsBytes instead of AsSliceU8 and changed related functions as necessary. Fixes hermit-os#692.
Changed VirtioNetHdr to derive from AsBytes instead of AsSliceU8 and changed related functions as necessary. Fixes hermit-os#692.
Changed VirtioNetHdr to derive from AsBytes instead of AsSliceU8 and changed related functions as necessary. Fixes hermit-os#692.
Changed VirtioNetHdr to derive from AsBytes instead of AsSliceU8 and changed related functions as necessary. Fixes hermit-os#692.
Attempts to completely remove the AsSliceU8 trait by directly implementing AsBytes for generic structs because of lack of support for generics using derive. Fixes hermit-os#692. Signed-off-by: Joanne Chen <joannejc@cs.utexas.edu>
Attempts to completely remove the AsSliceU8 trait by directly implementing AsBytes for generic structs because of lack of support for generics using derive. Fixes hermit-os#692. Signed-off-by: Joanne Chen <joannejc@cs.utexas.edu>
Changed VirtioNetHdr to derive from AsBytes instead of AsSliceU8 and changed related functions as necessary. AsSliceU8 cannot be completely removed yet because of lack of support for deriving AsBytes for generics. Fixes hermit-os#692.
Just as an aside, there is a proposal for |
|
Superseded by #1316 |
Padding is uninitialized: Glossary - Unsafe Code Guidelines Reference
We do not check for padding, neither is
AsSliceU8
unsafe.zerocopy::AsBytes
performs these checks.The text was updated successfully, but these errors were encountered: