use bit field or kernel *_bit()

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

 



Hi folks

In kernel code, if we want to represent some bits, like buffer_head
state, we at least can use 2 ways

one is c bit field like

struct x{
int bita:1;
int bitb:1;
...

}

or use a unsigned long xyz, and use test_bit, set_bit, clear_bit to work
on it.

then the question is when we should use which way? thanks!

Ming



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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