Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
8 changes: 4 additions & 4 deletions src/ioctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::os::fd::BorrowedFd;

use rustix::{
io::Errno,
ioctl::{ioctl, Setter, WriteOpcode},
ioctl::{ioctl, opcode, Setter},
};

use crate::BufferError;
Expand All @@ -22,13 +22,13 @@ struct dma_buf_sync {
}

fn dma_buf_sync_ioctl(fd: BorrowedFd<'_>, flags: u64) -> Result<(), Errno> {
type Opcode = WriteOpcode<DMA_BUF_BASE, DMA_BUF_IOCTL_SYNC, dma_buf_sync>;

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::<Opcode, dma_buf_sync>::new(sync) };
let ioctl_type = unsafe {
Setter::<{ opcode::write::<dma_buf_sync>(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
Expand Down
Loading