lkml.org 
[lkml]   [2008]   [Feb]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 12 Feb 2008 17:04:24 -0800 (PST)
FromChristoph Lameter <>
SubjectRe: [patch 1/4] mempolicy: convert MPOL constants to enum
On Tue, 12 Feb 2008, Paul Jackson wrote:

> I'm inclined toward the original types for the 'policy' field.

Good. And remove the enum.

> Specifically, I'd suggest adding the one line for 'mode_f_static_nodes'
> as below, and leaving the code involving the encoding of the policy
> field alone.
> 
> struct mempolicy {
>         atomic_t refcnt;
>         short policy;   /* See MPOL_* above */
> 	int mode_f_static_nodes:1;			/* <== Added line <== */

It would be better to add some sort of flags field?

> Single bit fields (The ":1" above) provide the simplest way to add
> boolean flags to structs.  Let the compiler do the work of packing
> and unpacking the field.

We usually do that with unsigned XXX and constants. You may want to check 
multiple flags at once or do other fancy things.



\
 
 \ /
  Last update: 2008-02-13 02:07    [from the cache]
©2003-2008