From e7322b74dcb88dad696d8f3b0b4feff2f129e823 Mon Sep 17 00:00:00 2001 From: Marcin Radomski Date: Mon, 30 Jun 2025 11:50:30 +0000 Subject: [PATCH] Update drm-ffi to use rustix 1.0.7 Enables upgrade of rustix done in ag/34209685. Applies changes done in WIP upstream PR: https://github.com/Smithay/drm-rs/pull/223 Bug: 427560497 Test: m rust Change-Id: I2f3ee90e9c2b294a5de8f84efd67101825c3cee5 --- Cargo.toml | 2 +- src/ioctl.rs | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 20baf0964..0217d279c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ path = "src/lib.rs" version = "0.8.0" [dependencies.rustix] -version = "0.38.22" +version = "1.0.7" [features] use_bindgen = ["drm-sys/use_bindgen"] diff --git a/src/ioctl.rs b/src/ioctl.rs index c053ede5a..e376122dc 100644 --- a/src/ioctl.rs +++ b/src/ioctl.rs @@ -1,15 +1,13 @@ use std::{ffi::c_uint, io, os::unix::io::BorrowedFd}; use drm_sys::*; -use rustix::ioctl::{ - ioctl, Getter, NoArg, NoneOpcode, ReadOpcode, ReadWriteOpcode, Setter, Updater, WriteOpcode, -}; +use rustix::ioctl::{ioctl, opcode, Getter, NoArg, Opcode, Setter, Updater}; macro_rules! ioctl_readwrite { ($name:ident, $ioty:expr, $nr:expr, $ty:ty) => { pub unsafe fn $name(fd: BorrowedFd, data: &mut $ty) -> io::Result<()> { - type Opcode = ReadWriteOpcode<$ioty, $nr, $ty>; - Ok(ioctl(fd, Updater::::new(data))?) + const OPCODE: Opcode = opcode::read_write::<$ty>($ioty, $nr); + Ok(ioctl(fd, Updater::::new(data))?) } }; } @@ -17,8 +15,8 @@ macro_rules! ioctl_readwrite { macro_rules! ioctl_read { ($name:ident, $ioty:expr, $nr:expr, $ty:ty) => { pub unsafe fn $name(fd: BorrowedFd) -> io::Result<$ty> { - type Opcode = ReadOpcode<$ioty, $nr, $ty>; - Ok(ioctl(fd, Getter::::new())?) + const OPCODE: Opcode = opcode::read::<$ty>($ioty, $nr); + Ok(ioctl(fd, Getter::::new())?) } }; } @@ -26,8 +24,8 @@ macro_rules! ioctl_read { macro_rules! ioctl_write_ptr { ($name:ident, $ioty:expr, $nr:expr, $ty:ty) => { pub unsafe fn $name(fd: BorrowedFd, data: &$ty) -> io::Result<()> { - type Opcode = WriteOpcode<$ioty, $nr, $ty>; - Ok(ioctl(fd, Setter::::new(*data))?) + const OPCODE: Opcode = opcode::write::<$ty>($ioty, $nr); + Ok(ioctl(fd, Setter::::new(*data))?) } }; } @@ -35,8 +33,8 @@ macro_rules! ioctl_write_ptr { macro_rules! ioctl_none { ($name:ident, $ioty:expr, $nr:expr) => { pub unsafe fn $name(fd: BorrowedFd) -> io::Result<()> { - type Opcode = NoneOpcode<$ioty, $nr, ()>; - Ok(ioctl(fd, NoArg::::new())?) + const OPCODE: Opcode = opcode::none($ioty, $nr); + Ok(ioctl(fd, NoArg::::new())?) } }; } -- 2.50.0.727.gbf7dc18ff4-goog