Skip to content

Commit e5502b5

Browse files
🚨 (sys): Make compiler happy.
- upgrade bindgen. (datenlord#28) - set rust toolchain version. (rust-lang/rust-bindgen#3052) - add handwritten debug impl.
1 parent ad39d0c commit e5502b5

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ repository = "https://github.com/datenlord/rdma-sys"
1010

1111
[dependencies]
1212
libc = "0.2"
13-
memoffset = "0.6"
13+
memoffset = "0.9"
1414
paste = "1.0"
1515
# intrusive-collections = "0.9"
1616

1717
[build-dependencies]
18-
bindgen = "0.59.2"
18+
bindgen = "0.71"
1919
pkg-config = "0.3"

build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fn main() {
4343
let include_args = include_paths.iter().map(|p| format!("-I{}", p));
4444

4545
let bindings = bindgen::Builder::default()
46+
.rust_target("1.72.0".parse().unwrap())
4647
.clang_args(include_args)
4748
.header("src/bindings.h")
4849
.allowlist_function("ibv_.*")
@@ -148,8 +149,9 @@ fn main() {
148149
//.generate_inline_functions(true)
149150
//.default_macro_constant_type(bindgen::MacroTypeVariation::Unsigned)
150151
.prepend_enum_name(false)
151-
.rustfmt_bindings(true)
152+
.formatter(bindgen::Formatter::Rustfmt)
152153
.size_t_is_usize(true)
154+
.wrap_unsafe_ops(true)
153155
.disable_untagged_union()
154156
.generate()
155157
.expect("Unable to generate bindings");

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.74.0"
3+
profile = "default"

src/types.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,36 @@ pub struct rdma_cm_event {
297297
pub status: c_int,
298298
pub param: param_t,
299299
}
300+
301+
impl std::fmt::Debug for ibv_access_flags {
302+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
303+
f.debug_tuple("ibv_access_flags").field(&self.0).finish()
304+
}
305+
}
306+
307+
impl std::fmt::Debug for ibv_event_type {
308+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
309+
match self {
310+
Self::IBV_EVENT_CQ_ERR => write!(f, "IBV_EVENT_CQ_ERR"),
311+
Self::IBV_EVENT_QP_FATAL => write!(f, "IBV_EVENT_QP_FATAL"),
312+
Self::IBV_EVENT_QP_REQ_ERR => write!(f, "IBV_EVENT_QP_REQ_ERR"),
313+
Self::IBV_EVENT_QP_ACCESS_ERR => write!(f, "IBV_EVENT_QP_ACCESS_ERR"),
314+
Self::IBV_EVENT_COMM_EST => write!(f, "IBV_EVENT_COMM_EST"),
315+
Self::IBV_EVENT_SQ_DRAINED => write!(f, "IBV_EVENT_SQ_DRAINED"),
316+
Self::IBV_EVENT_PATH_MIG => write!(f, "IBV_EVENT_PATH_MIG"),
317+
Self::IBV_EVENT_PATH_MIG_ERR => write!(f, "IBV_EVENT_PATH_MIG_ERR"),
318+
Self::IBV_EVENT_DEVICE_FATAL => write!(f, "IBV_EVENT_DEVICE_FATAL"),
319+
Self::IBV_EVENT_PORT_ACTIVE => write!(f, "IBV_EVENT_PORT_ACTIVE"),
320+
Self::IBV_EVENT_PORT_ERR => write!(f, "IBV_EVENT_PORT_ERR"),
321+
Self::IBV_EVENT_LID_CHANGE => write!(f, "IBV_EVENT_LID_CHANGE"),
322+
Self::IBV_EVENT_PKEY_CHANGE => write!(f, "IBV_EVENT_PKEY_CHANGE"),
323+
Self::IBV_EVENT_SM_CHANGE => write!(f, "IBV_EVENT_SM_CHANGE"),
324+
Self::IBV_EVENT_SRQ_ERR => write!(f, "IBV_EVENT_SRQ_ERR"),
325+
Self::IBV_EVENT_SRQ_LIMIT_REACHED => write!(f, "IBV_EVENT_SRQ_LIMIT_REACHED"),
326+
Self::IBV_EVENT_QP_LAST_WQE_REACHED => write!(f, "IBV_EVENT_QP_LAST_WQE_REACHED"),
327+
Self::IBV_EVENT_CLIENT_REREGISTER => write!(f, "IBV_EVENT_CLIENT_REREGISTER"),
328+
Self::IBV_EVENT_GID_CHANGE => write!(f, "IBV_EVENT_GID_CHANGE"),
329+
Self::IBV_EVENT_WQ_FATAL => write!(f, "IBV_EVENT_WQ_FATAL"),
330+
}
331+
}
332+
}

0 commit comments

Comments
 (0)