| From | Alejandro Colomar <> | Subject | [PATCH v2 03/20] linux/stddef.h, linux/offsetofend.h: Split offsetofend() into a separate header | Date | Sat, 20 Nov 2021 14:00:46 +0100 |
| |
Include <linux/offsetofend.h> from <linux/stddef.h> for compatibility.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com> --- include/linux/offsetofend.h | 19 +++++++++++++++++++ include/linux/stddef.h | 10 +--------- 2 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 include/linux/offsetofend.h
diff --git a/include/linux/offsetofend.h b/include/linux/offsetofend.h new file mode 100644 index 000000000000..20fe2905629d --- /dev/null +++ b/include/linux/offsetofend.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_OFFSETOFEND_H +#define _LINUX_OFFSETOFEND_H + + +#include <linux/offsetof.h> +#include <linux/sizeof_field.h> + + +/** + * offsetofend() - Report the offset of a struct field within the struct + * + * @T: The type of the structure + * @m: The member within the structure to get the end offset of + */ +#define offsetofend(T, m) (offsetof(T, m) + sizeof_field(T, m)) + + +#endif /* _LINUX_OFFSETOFEND_H */ diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 1be2c71c1e85..c2e7e5051ef3 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -6,6 +6,7 @@ #include <uapi/linux/stddef.h> #include <linux/offsetof.h> +#include <linux/offsetofend.h> #include <linux/sizeof_field.h> @@ -17,15 +18,6 @@ enum { true = 1 }; -/** - * offsetofend() - Report the offset of a struct field within the struct - * - * @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_field(TYPE, MEMBER)) - /** * struct_group() - Wrap a set of declarations in a mirrored struct * -- 2.33.1
|