rust: ioctl: Add ioctl number manipulation functions
authorAsahi Lina <lina@asahilina.net>
Mon, 3 Apr 2023 09:33:53 +0000 (18:33 +0900)
committerMiguel Ojeda <ojeda@kernel.org>
Fri, 21 Apr 2023 23:46:45 +0000 (01:46 +0200)
commitea76e08f4d901a450619831a255e9e0a4c0ed162
treeda9bf4ca1eab8f9e0c9ac659dd7af3d50f88509e
parent4e1746656839ab1e88d76eec4d2fa0b41d585604
rust: ioctl: Add ioctl number manipulation functions

Add simple 1:1 wrappers of the C ioctl number manipulation functions.
Since these are macros we cannot bindgen them directly, and since they
should be usable in const context we cannot use helper wrappers, so
we'll have to reimplement them in Rust. Thankfully, the C headers do
declare defines for the relevant bitfield positions, so we don't need
to duplicate that.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Link: https://lore.kernel.org/r/20230329-rust-uapi-v2-2-bca5fb4d4a12@asahilina.net
[ Moved the `#![allow(non_snake_case)]` to the usual place. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/ioctl.rs [new file with mode: 0644]
rust/kernel/lib.rs