diff mbox series

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

Message ID 20211019214320.2035704-7-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to kernel 5.15-rc6 | expand

Commit Message

Hauke Mehrtens Oct. 19, 2021, 9:42 p.m. UTC
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 <hauke@hauke-m.de>
---
 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 mbox series

Patch

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>