mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-27 21:47:56 +00:00
btrfs-progs: kerncompat: define __DECLARE_FLEX_ARRAY if missing
The macro is not available on LTS distros, copy definition from kernel. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ed1f7ac5ed
commit
d6e23e1d5f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user