mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/include: import sizeof_field() macro from Linux stddef.h
Co-locate it with the definition of offsetof() (since this is also in stddef.h in the Linux kernel source). This macro will be needed in a subsequent patch. Signed-off-by: Paul Durrant <pdurrant@amazon.com> Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
1e6d7bd585
commit
758fae24d7
1 file changed
+8
@@ -76,6 +76,14 @@
|
||||
|
||||
#define offsetof(a,b) __builtin_offsetof(a,b)
|
||||
|
||||
/**
|
||||
* sizeof_field(TYPE, MEMBER)
|
||||
*
|
||||
* @TYPE: The structure containing the field of interest
|
||||
* @MEMBER: The field to return the size of
|
||||
*/
|
||||
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
|
||||
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
|
||||
#define alignof __alignof__
|
||||
#endif
|
||||
|
||||