Move agnostic ioctl function and constants into its own module