diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-03-09 15:52:17 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-03-17 09:25:28 +0100 |
commit | 3876488444e71238e287459c39d7692b6f718c3e (patch) | |
tree | 8526a5d193495a1707ffea70dcb7b0931a5981a9 /include/linux/stddef.h | |
parent | 5c39403e004bec75ce0c549541be5479595d6ad0 (diff) | |
download | lwn-3876488444e71238e287459c39d7692b6f718c3e.tar.gz lwn-3876488444e71238e287459c39d7692b6f718c3e.zip |
include/stddef.h: Move offsetofend() from vfio.h to a generic kernel header
Suggested by Andy.
Suggested-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1425912738-559-1-git-send-email-dvlasenk@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/stddef.h')
-rw-r--r-- | include/linux/stddef.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/stddef.h b/include/linux/stddef.h index f4aec0e75c3a..076af437284d 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -19,3 +19,12 @@ enum { #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif #endif + +/** + * 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)) |