ioctl-gen 0.1.1

Simple macros for generating ioctl numbers.
Documentation
  • Coverage
  • 100%
    25 out of 25 items documented1 out of 1 items with examples
  • Size
  • Source code size: 5.85 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.56 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • quadrupleslap-old/ioctl-gen
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • quadrupleslap

#6 ioctl-gen

Documentation

Making those magic ioctl numbers is really annoying without macros, so here are some macros. And if you were wondering, yes, they work in constants.

Example

#[macro_use]
extern crate ioctlify;

// Taken from <linux/videodev2.h>
const VIDIOC_RESERVED:   u32 = io!(b'V', 1);
const VIDIOC_STREAMON:   u32 = iow!(b'V', 18, 4);
const VIDIOC_LOG_STATUS: u32 = io!(b'V', 70);

assert_eq!(ioc_type!(VIDIOC_RESERVED), b'V' as u32);
assert_eq!(VIDIOC_STREAMON, 1074026002);
assert_eq!(ioc_nr!(VIDIOC_LOG_STATUS), 70);

Installation

In Cargo.toml:

[dependencies]
ioctl-gen = "0.1.0"

License

The MIT license.