From 61ffa56d6db9da81afbe3eb6586980cefb2584ec Mon Sep 17 00:00:00 2001 From: Andreas Abel Date: Fri, 17 Jan 2020 16:09:42 +0100 Subject: [PATCH] compatibility with kernel 4.4 --- kernel/nb_km.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/nb_km.c b/kernel/nb_km.c index 6a9b2fa..baf423a 100644 --- a/kernel/nb_km.c +++ b/kernel/nb_km.c @@ -15,10 +15,17 @@ #include #include #include -#include #include +#include +#include #include <../arch/x86/include/asm/fpu/api.h> +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,12,0) +#include +#else +#include +#endif + #include "../common/nanoBench.h" MODULE_LICENSE("GPL"); @@ -52,7 +59,12 @@ static int read_file_into_buffer(const char *file_name, char **buf, size_t *buf_ struct path p; struct kstat ks; kern_path(file_name, 0, &p); - if (vfs_getattr(&p, &ks, 0, 0)) { + +#if LINUX_VERSION_CODE <= KERNEL_VERSION(4,11,0) + if (vfs_getattr(&p, &ks)) { +#else + if (vfs_getattr(&p, &ks, 0, 0)) { +#endif pr_debug("Error getting file attributes\n"); return -1; }