Messages in this thread | | | Date | Thu, 01 Oct 2009 12:15:17 -0400 | From | Jeff Garzik <> | Subject | Re: [PATCH 10/19] workqueue: update cwq alignement and make one more flag bit available |
| |
On 10/01/2009 09:05 AM, David Howells wrote: > Tejun Heo<tj@kernel.org> wrote: > >> +enum { >> + WORK_STRUCT_PENDING = 0, /* work item is pending execution */ >> + >> + /* >> + * Reserve 3bits off of cwq pointer. This is enough and >> + * provides acceptable alignment on both 32 and 64bit >> + * machines. >> + */ >> + WORK_STRUCT_FLAG_BITS = 3, >> + >> + WORK_STRUCT_FLAG_MASK = (1UL<< WORK_STRUCT_FLAG_BITS) - 1, >> + WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, >> +}; > > There's some great enum abuse going on here:-)
The quoted code is a standard kernel technique for creating typed constants that are visible to the C compiler (rather than CPP) and debugger.
It is found in a great many Linux kernel drivers at this point, and is definitely not abuse, IMO.
Jeff
| |