lkml.org 
[lkml]   [2021]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/17] linux/offsetofend.h: Move offsetofend(T, m) to a separate header
Date
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>
---
include/linux/filter.h | 1 +
include/linux/offsetofend.h | 19 +++++++++++++++++++
include/linux/skmsg.h | 1 +
include/linux/stddef.h | 10 +---------
include/linux/string.h | 1 +
5 files changed, 23 insertions(+), 9 deletions(-)
create mode 100644 include/linux/offsetofend.h

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>


@@ -13,15 +14,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
*
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>

--
2.33.1
\
 
 \ /
  Last update: 2021-11-19 12:39    [W:0.442 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site