diff --git a/include/kerncompat.h b/include/kerncompat.h index 3f981bf3..31cd9d8d 100644 --- a/include/kerncompat.h +++ b/include/kerncompat.h @@ -103,6 +103,26 @@ #define BUILD_ASSERT(x) #endif +#ifndef __DECLARE_FLEX_ARRAY +/* + * Copied from linux.git/include/uapi/stddef.h + * + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union + * + * @TYPE: The type of each flexible array element + * @NAME: The name of the flexible array member + * + * In order to have a flexible array member in a union or alone in a struct, it + * needs to be wrapped in an anonymous struct with at least 1 named member, but + * that member can be empty. + */ +#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif + static inline void print_trace(void) { #ifndef BTRFS_DISABLE_BACKTRACE