ioctl-macros 0.1.0

Rust macros that can be used to generate ioctl numbers on unix systems
Documentation
#ifdef __linux__
# include <asm/ioctl.h>
# define _IO(type,nr)           _IOC(_IOC_NONE,(type),(nr),0)
# define _IOR(type,nr,size)     _IOC(_IOC_READ,(type),(nr),(size))
# define _IOW(type,nr,size)     _IOC(_IOC_WRITE,(type),(nr),(size))
# define _IOWR(type,nr,size)    _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(size))
#elif __unix__
# include <sys/ioccom.h>
# define _IO(type,nr)           _IOC(IOC_VOID,(type),(nr),0)
# define _IOR(type,nr,size)     _IOC(IOC_OUT,(type),(nr),(size))
# define _IOW(type,nr,size)     _IOC(IOC_IN,(type),(nr),(size))
# define _IOWR(type,nr,size)     _IOC(IOC_INOUT,(type),(nr),(size))
#endif

#include <stdio.h>

int _c_io(int ty, int nr) {
    return _IO(ty, nr);
}

int _c_ior(int ty, int nr, int size) {
    return _IOR(ty, nr, size);
}

int _c_iow(int ty, int nr, int size) {
    return _IOW(ty, nr, size);
}

int _c_iowr(int ty, int nr, int size) {
    return _IOWR(ty, nr, size);
}