[PATCH 06/47] headers: Add linux/kcov.h

Hauke Mehrtens <[email protected]>
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
This adds empty implementation for kcov_remote_start_common() and
kcov_remote_stop() on older kernel versions. kcov will probably not work
properly when used with backports and older kernel versions.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 backport/backport-include/linux/kcov.h  | 16 ++++++++++++++++
 backport/backport-include/linux/sched.h |  5 +++++
 2 files changed, 21 insertions(+)
 create mode 100644 backport/backport-include/linux/kcov.h

diff --git a/backport/backport-include/linux/kcov.h b/backport/backport-include/linux/kcov.h
new file mode 100644
index 00000000..92095e63
--- /dev/null
+++ b/backport/backport-include/linux/kcov.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __BACKPORTS_LINUX_KCOV_H
+#define __BACKPORTS_LINUX_KCOV_H
+#include <linux/version.h>
+#if LINUX_VERSION_IS_GEQ(4,6,0)
+#include_next <linux/kcov.h>
+#endif
+
+#if LINUX_VERSION_IS_LESS(5,5,0)
+#define kcov_remote_stop LINUX_BACKPORT(kcov_remote_stop)
+static inline void kcov_remote_stop(void) {}
+#define kcov_remote_start_common LINUX_BACKPORT(kcov_remote_start_common)
+static inline void kcov_remote_start_common(u64 id) {}
+#endif
+
+#endif /* __BACKPORTS_LINUX_KCOV_H */
diff --git a/backport/backport-include/linux/sched.h b/backport/backport-include/linux/sched.h
index 36263857..6a5cf8db 100644
--- a/backport/backport-include/linux/sched.h
+++ b/backport/backport-include/linux/sched.h
@@ -4,6 +4,11 @@
 #include_next <linux/sched.h>
 #include <linux/version.h>
 
+/* kcov was added in 4.6 and is included since then */
+#if LINUX_VERSION_IS_LESS(4,6,0)
+#include <linux/kcov.h>
+#endif
+
 #if LINUX_VERSION_IS_LESS(5,9,0)
 #if LINUX_VERSION_IS_GEQ(4,11,0)
 #include <uapi/linux/sched/types.h>
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.