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

Cast RawOpcode to the internal ioctl_code type (c_uint) #44

Merged
merged 1 commit into from
Mar 2, 2024

Conversation

jonlamb-gh
Copy link
Contributor

The rustix RawOpcode type can vary depending on the target.
For example, targets that use the libc Linux configuration in rustix, the RawOpcode type is a type alias to c_ulong rather than c_uint.
I believe the UsbFsIoctl struct should remain the same in these configurations.

Discovered this while attempting to build for s390x-unknown-linux-gnu.

error[E0308]: mismatched types
  --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nusb-0.1.6/src/platform/linux_usbfs/usbfs.rs:78:25
   |
78 |             ioctl_code: ioctl::NoneOpcode::<b'U', 23, ()>::OPCODE.raw(), // IOCTL_USBFS_CONNECT
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`

The rustix `RawOpcode` type can vary depending on the target.
For example, targets that use the libc Linux configuration in rustix, the
`RawOpcode` type is a type alias to `c_ulong` rather than `c_uint`.
@kevinmehall
Copy link
Owner

Thanks!

@kevinmehall kevinmehall merged commit f057627 into kevinmehall:main Mar 2, 2024
4 checks passed
@kevinmehall
Copy link
Owner

I don't think it actually matters, but the ioctl_code is a signed int in the kernel headers.

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