Messages in this thread | | | From | Linus Torvalds <> | Date | Fri, 6 Jan 2023 14:06:51 -0800 | Subject | Re: [PATCH v14 2/7] mm: add VM_DROPPABLE for designating always lazily freeable mappings |
| |
On Fri, Jan 6, 2023 at 1:42 PM Matthew Wilcox <willy@infradead.org> wrote: > > > I'd be more inclined to do: > > typedef unsigned int vm_flags_t[2];
No, that's entirely invalid.
Never *ever* use arrays in C for type safety. Arrays are not type safe. They can't be assigned sanely, and they silently become pointers (which also aren't type-safe, since they end up converting silently to 'void *').
If you want to use the type system to enforce things, and you don't want to rely on sparse, you absolutely have to use a struct (or union) type.
So something like
typedef struct { u64 val; } vm_flags_t;
would be an option.
Linus
| |