Skip to content

Commit b928c6b

Browse files
Johan-Liebert1cgwalters
authored andcommitted
ioctl: Use raw opcodes to match kernel definitions
Replace rustix ioctl macros with hardcoded values for LOOP_CTL_GET_FREE and LOOP_CONFIGURE. The macro-generated opcodes don't match the kernel's expected values, causing EINVAL errors. The older kernels (even new ones 6.18 for that matter) define these as raw numbers rather than following the modern _IOW/_IOR conventions I have tested this on Fedora 42 (6.18), and CI failure occured on Ubuntu 22.04. I won't if this is distro related and if different distros have different headers Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent 022c9c6 commit b928c6b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

crates/composefs-ioctls/src/loop_device.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::{
1111
os::fd::{AsFd, AsRawFd, OwnedFd},
1212
};
1313

14-
use rustix::ioctl::{ioctl, opcode, Opcode, Setter};
14+
use rustix::ioctl::{ioctl, Opcode, Setter};
1515

1616
/// Flags for loop device configuration.
1717
pub mod flags {
@@ -102,9 +102,9 @@ unsafe impl rustix::ioctl::Ioctl for LoopCtlGetFree {
102102
}
103103
}
104104

105-
const LOOP_CTL_GET_FREE: Opcode = opcode::none(0x4C, 0x82);
105+
const LOOP_CTL_GET_FREE: Opcode = 0x4C82;
106106
// #define LOOP_CONFIGURE 0x4C0A
107-
const LOOP_CONFIGURE: Opcode = opcode::write::<LoopConfig>(0x4C, 0x0A);
107+
const LOOP_CONFIGURE: Opcode = 0x4C0A;
108108

109109
/// Creates a loop device backed by the given file.
110110
///

0 commit comments

Comments
 (0)