diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-11-19 02:37:09 +0100 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2021-11-19 02:37:09 +0100 |
commit | a50dc98395aa8307198706ba4c3b4633bc2e6077 (patch) | |
tree | d300b60e1f0fbaafe1106e4ac378e30a3f24df1a | |
parent | 1c372b53674e52056420cf049c3c51908681f3f0 (diff) |
linux/offsetofend.h: Move offsetofend(T, m) to a separate header
Touching files so used for the kernel,
forces 'make' to recompile most of the kernel.
Having those definitions in more granular files
helps avoid recompiling so much of the kernel.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r-- | include/linux/filter.h | 1 | ||||
-rw-r--r-- | include/linux/offsetofend.h | 19 | ||||
-rw-r--r-- | include/linux/skmsg.h | 1 | ||||
-rw-r--r-- | include/linux/stddef.h | 10 | ||||
-rw-r--r-- | include/linux/string.h | 1 |
5 files changed, 23 insertions, 9 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index ebb0ae480533..5593d0365694 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -18,6 +18,7 @@ #include <linux/kallsyms.h> #include <linux/if_vlan.h> #include <linux/offsetof.h> +#include <linux/offsetofend.h> #include <linux/sizeof_field.h> #include <linux/vmalloc.h> #include <linux/sockptr.h> diff --git a/include/linux/offsetofend.h b/include/linux/offsetofend.h new file mode 100644 index 000000000000..4f4d0e1b667a --- /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 + * + * @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)) + + +#endif /* _LINUX_OFFSETOFEND_H */ diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 584d94be9c8b..46e76f4ff0de 100644 --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -6,6 +6,7 @@ #include <linux/bpf.h> #include <linux/filter.h> +#include <linux/offsetofend.h> #include <linux/scatterlist.h> #include <linux/skbuff.h> diff --git a/include/linux/stddef.h b/include/linux/stddef.h index 5c9aedb5e6ad..da50edf4b28d 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -5,6 +5,7 @@ #include <uapi/linux/stddef.h> #include <linux/NULL.h> #include <linux/offsetof.h> +#include <linux/offsetofend.h> #include <linux/sizeof_field.h> @@ -14,15 +15,6 @@ enum { }; /** - * 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 * * @NAME: The identifier name of the mirrored sub-struct diff --git a/include/linux/string.h b/include/linux/string.h index 5a22a93c53f5..555b6f00c73d 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -7,6 +7,7 @@ #include <linux/types.h> /* for size_t */ #include <linux/errno.h> /* for E2BIG */ #include <linux/offsetof.h> +#include <linux/offsetofend.h> #include <linux/stdarg.h> #include <uapi/linux/string.h> |