why not choose another way to define the _IOC_xxxMASK related to the ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux