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

[WIP] Add Guid type hiding raw ibv GUID #16

Merged
merged 3 commits into from
Nov 10, 2021

Conversation

planetA
Copy link
Contributor

@planetA planetA commented Aug 22, 2021

Create new Guid type that takes care of endianness conversion.

@planetA planetA mentioned this pull request Aug 22, 2021
@jonhoo
Copy link
Owner

jonhoo commented Aug 26, 2021

Ah, I see what you're going for, but I think I wouldn't try a solution quite this drastic. It's fine to leave the __be64 type in bindgen — we don't generally expect people to be reaching into the ffi module. Then the error you were running into should also go away. I've also left a couple of notes inline.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

Looking better! I left a few more inline comments.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@planetA planetA force-pushed the mplaneta/guid-type branch from 25aeb5e to 9e4c338 Compare October 19, 2021 18:52
Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

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

This looks good, just one more nit!

src/lib.rs Outdated
if guid == 0 {
pub fn guid(&self) -> io::Result<Guid> {
let guid_int = unsafe { ffi::ibv_get_device_guid(*self.0) };
let guid : Guid = guid_int.into();
Copy link
Owner

Choose a reason for hiding this comment

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

I think rustfmt probably doesn't agree with the formatting here. Could you run rustfmt on the code and then update the PR?

@planetA planetA force-pushed the mplaneta/guid-type branch from 9e4c338 to eaf0a03 Compare November 8, 2021 08:48
Create new Guid type that takes care of endianness conversion.
@planetA planetA force-pushed the mplaneta/guid-type branch from eaf0a03 to 501c9e7 Compare November 8, 2021 08:52
ibverbs/src/lib.rs Outdated Show resolved Hide resolved
ibverbs/src/lib.rs Outdated Show resolved Hide resolved
@jonhoo jonhoo merged commit 6037f6d into jonhoo:master Nov 10, 2021
@jonhoo
Copy link
Owner

jonhoo commented Nov 10, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants