[CRIU] [PATCH 02/18] compiler: Add FIELD_SIZEOF helper

Cyrill Gorcunov gorcunov at gmail.com
Thu Jul 19 15:47:30 MSK 2018


Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 include/common/compiler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/common/compiler.h b/include/common/compiler.h
index ada79f293300..eaf545b26c29 100644
--- a/include/common/compiler.h
+++ b/include/common/compiler.h
@@ -57,6 +57,10 @@
 	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
 	(type *)( (char *)__mptr - offsetof(type,member) );})
 
+#ifndef FIELD_SIZEOF
+# define FIELD_SIZEOF(t, f)	(sizeof(((t*)0)->f))
+#endif
+
 #define __round_mask(x, y)	((__typeof__(x))((y) - 1))
 #define round_up(x, y)		((((x) - 1) | __round_mask(x, y)) + 1)
 #define round_down(x, y)	((x) & ~__round_mask(x, y))
-- 
2.14.4



More information about the CRIU mailing list