diff --git a/Cargo.toml b/Cargo.toml index 18f41e5..c8e7d4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ categories = ["api-bindings", "os::linux-apis"] repository = "https://github.com/mripard/dma-buf/" [dependencies] -rustix = { version = "0.38.31", features = ["fs", "mm", "param"] } +rustix = { version = "1.0.5", features = ["fs", "mm", "param"] } thiserror = "2.0.3" tracing = { version = "0.1.41", default-features = false, features = ["std"] } diff --git a/src/ioctl.rs b/src/ioctl.rs index 9de1117..fa6d8a7 100644 --- a/src/ioctl.rs +++ b/src/ioctl.rs @@ -2,7 +2,7 @@ use std::os::fd::BorrowedFd; use rustix::{ io::Errno, - ioctl::{ioctl, Setter, WriteOpcode}, + ioctl::{ioctl, opcode, Setter}, }; use crate::BufferError; @@ -22,13 +22,13 @@ struct dma_buf_sync { } fn dma_buf_sync_ioctl(fd: BorrowedFd<'_>, flags: u64) -> Result<(), Errno> { - type Opcode = WriteOpcode; - let sync = dma_buf_sync { flags }; // SAFETY: This function is unsafe because the opcode has to be valid, and the value type must // match. We have checked those, so we're good. - let ioctl_type = unsafe { Setter::::new(sync) }; + let ioctl_type = unsafe { + Setter::<{ opcode::write::(DMA_BUF_BASE, DMA_BUF_IOCTL_SYNC) }, dma_buf_sync>::new(sync) + }; // SAFETY: This function is unsafe because the driver isn't guaranteed to implement the ioctl, // and to implement it properly. We don't have much of a choice and still have to trust the