Message ID | 20170821222817.17376-15-hauke@hauke-m.de (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
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 */
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@hauke-m.de> --- backport/backport-include/linux/stddef.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backport/backport-include/linux/stddef.h