Go to the documentation of this file.
4 #include <linux/types.h>
7 #define FLEX_ARRAY_PART_SIZE PAGE_SIZE
8 #define FLEX_ARRAY_BASE_SIZE PAGE_SIZE
37 #define FLEX_ARRAY_BASE_BYTES_LEFT \
38 (FLEX_ARRAY_BASE_SIZE - offsetof(struct flex_array, parts))
41 #define FLEX_ARRAY_NR_BASE_PTRS \
42 (FLEX_ARRAY_BASE_BYTES_LEFT / sizeof(struct flex_array_part *))
45 #define FLEX_ARRAY_ELEMENTS_PER_PART(size) \
46 (FLEX_ARRAY_PART_SIZE / size)
52 #define DEFINE_FLEX_ARRAY(__arrayname, __element_size, __total) \
53 struct flex_array __arrayname = { { { \
54 .element_size = (__element_size), \
55 .total_nr_elements = (__total), \
57 static inline void __arrayname##_invalid_parameter(void) \
59 BUILD_BUG_ON((__total) > FLEX_ARRAY_NR_BASE_PTRS * \
60 FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \
75 #define flex_array_put_ptr(fa, nr, src, gfp) \
76 flex_array_put(fa, nr, (void *)&(src), gfp)