[PATCH 14/21] header: add offsetofend()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



offsetofend() was moved from vfio.h to stddef.h in commit
3876488444e7123 ("include/stddef.h: Move offsetofend() from vfio.h to a
generic kernel header") for kernel 4.1. Add it again to stddef.h so it
is available in more include paths.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/stddef.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 backport/backport-include/linux/stddef.h

diff --git a/backport/backport-include/linux/stddef.h b/backport/backport-include/linux/stddef.h
new file mode 100644
index 00000000..2c836b00
--- /dev/null
+++ b/backport/backport-include/linux/stddef.h
@@ -0,0 +1,16 @@
+#ifndef __BACKPORT_LINUX_STDDEF_H
+#define __BACKPORT_LINUX_STDDEF_H
+#include_next <linux/stddef.h>
+
+#ifndef offsetofend
+/**
+ * offsetofend(TYPE, MEMBER)
+ *
+ * @TYPE: The type of the structure
+ * @MEMBER: The member within the structure to get the end offset of
+ */
+#define offsetofend(TYPE, MEMBER) \
+	(offsetof(TYPE, MEMBER)	+ sizeof(((TYPE *)0)->MEMBER))
+#endif
+
+#endif /* __BACKPORT_LINUX_STDDEF_H */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux