You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Tim Hardisty <ti...@hardisty.co.uk> on 2023/02/12 11:38:20 UTC

Ioctl numbering

I just completed a driver for a usb misc driver. I created my own sequential list of ioctl numbers (albeit based on a list from a similar driver), declared in the driver's header file.

I'm now doing a driver for an ambient light and proximity sensor and I see there is a dedicated sensors ioctl header file that lists many custom ioctls for many many sensors, with no duplication.

From my limited knowledge ioctl numbering ought to be unique just in case an incorrect ioctl is passed to a driver?

So, for my new driver, I think the right approach is for me to add new and unique entries at the end of the file for this new sensor - yes?

If so, ought we to also create an ioctl header file for usbmisc (and no doubt elsewhere)? But, that said, there is commonality between most of the ioctls for me new usbmisc driver and 2 existing ones so perhaps they ought at the very least to use the same numbers?

Or should there even be a global all-encompassing list of driver ioctl numbers?

What's the best practice here?