![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 #ifndef _UAPI_LINUX_STDDEF_H 0003 #define _UAPI_LINUX_STDDEF_H 0004 0005 #include <linux/compiler_types.h> 0006 0007 #ifndef __always_inline 0008 #define __always_inline inline 0009 #endif 0010 0011 /** 0012 * __struct_group() - Create a mirrored named and anonyomous struct 0013 * 0014 * @TAG: The tag name for the named sub-struct (usually empty) 0015 * @NAME: The identifier name of the mirrored sub-struct 0016 * @ATTRS: Any struct attributes (usually empty) 0017 * @MEMBERS: The member declarations for the mirrored structs 0018 * 0019 * Used to create an anonymous union of two structs with identical layout 0020 * and size: one anonymous and one named. The former's members can be used 0021 * normally without sub-struct naming, and the latter can be used to 0022 * reason about the start, end, and size of the group of struct members. 0023 * The named struct can also be explicitly tagged for layer reuse, as well 0024 * as both having struct attributes appended. 0025 */ 0026 #define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ 0027 union { \ 0028 struct { MEMBERS } ATTRS; \ 0029 struct TAG { MEMBERS } ATTRS NAME; \ 0030 } 0031 0032 /** 0033 * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union 0034 * 0035 * @TYPE: The type of each flexible array element 0036 * @NAME: The name of the flexible array member 0037 * 0038 * In order to have a flexible array member in a union or alone in a 0039 * struct, it needs to be wrapped in an anonymous struct with at least 1 0040 * named member, but that member can be empty. 0041 */ 0042 #define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ 0043 struct { \ 0044 struct { } __empty_ ## NAME; \ 0045 TYPE NAME[]; \ 0046 } 0047 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |