Re: [PATCH v2] rust: ioctl: Add ioctl number manipulation functions

From: Arnd Bergmann
Date: Thu Mar 23 2023 - 08:20:02 EST


On Thu, Mar 23, 2023, at 13:08, Asahi Lina wrote:
> Changes in v2:
> - Changed from assert!() to build_assert!() (static_assert!() can't work here)
...
> +/// Build an ioctl number, analogous to the C macro of the same name.
> +const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> u32 {
> + core::assert!(dir <= bindings::_IOC_DIRMASK);
> + core::assert!(ty <= bindings::_IOC_TYPEMASK);
> + core::assert!(nr <= bindings::_IOC_NRMASK);
> + core::assert!(size <= (bindings::_IOC_SIZEMASK as usize));

Just to make sure: did you actually change it according
to the changelog? It still looks like a runtime assertion
to me, but I don't really understand any rust.

Arnd