it defines in the kernel:
#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) //define
...
#define _IOC_NRSHIFT 0
...
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) //when decode
why not define it like this:
#define _IOC_NRSHIFT 0
...
#define _IOC_NRMASK ((_IOC_NRSHIFT >> _IOC_NRBITS) - _IOC_NRSHIFT) //define
...
#define _IOC_DIR(nr) ((nr & _IOC_DIRMASK) >> _IOC_DIRSHIFT) // when decode
I think it is better for the word "mask" .
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies