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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/03/2023 21.18, Arnd Bergmann wrote:
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.

Umm... I'm not sure what happened there.

Sorry, I'll resend it. I ran into some unrelated pain with bindgen versions while trying to compile-test this, and along the way I must have somehow dropped the actual v2 change...

~~ Lina




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux