codyps / ioctl

Helpers for binding ioctls in Rust
https://docs.rs/ioctl-sys
Apache License 2.0
4 stars 14 forks source link

Make cross-referencing values easier with hex representations #21

Open oldgalileo opened 2 years ago

oldgalileo commented 2 years ago

Though stylistic and not critical, it's a bit more difficult to find values when cross referencing against the Linux kernel when you also need to do a decimal<->hex conversion. Take:

https://github.com/jmesmon/ioctl/blob/508702e39a6c4b44daf1f402cc59739ddcab64da/ioctls/src/platform/linux-generated-x86_64.rs#L461

Here's the corresponding kernel def for reference:

https://elixir.bootlin.com/linux/v4.15.18/source/include/uapi/linux/sockios.h#L110

This would likely be better expressed as:

ioctl!(none siocadddlci with 0x89u8, 0x80u8);
codyps commented 2 years ago

This sounds like a reasonable thing to fix to me. I don't really use the ioctls part of this crate anymore though, so I'm unlikely to do it myself.