Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2016-05-10 15:43:59 +0200
committerMiroslav Benes <mbenes@suse.cz>2016-05-10 15:43:59 +0200
commit4186bef35862029a2fd36ba4a73d5fa538992709 (patch)
tree132301fdf01bca87881fc8c9dfc82b7cffa6c4aa
parent78cf6768b67dd6c437610feffce1d4fd9295fa97 (diff)
Add compat.h to deal with changes of KGR_PATCH macro
Sympos patch set for kGraft redefined KGR_PATCH macro and added two new ones. Add new compat.h which contains macro magic so that all kGraft patches would work on both old and new kernels with the patch set merged. Signed-off-by: Miroslav Benes <mbenes@suse.cz>
-rw-r--r--compat.h21
-rw-r--r--kgr_patch_main.c2
-rw-r--r--rpm/kgraft-patch.spec2
-rwxr-xr-xscripts/tar-up.sh1
4 files changed, 26 insertions, 0 deletions
diff --git a/compat.h b/compat.h
new file mode 100644
index 0000000..22bb082
--- /dev/null
+++ b/compat.h
@@ -0,0 +1,21 @@
+#ifndef _KGR_PATCH_COMPAT
+#define _KGR_PATCH_COMPAT
+
+#ifndef KGR_PATCH_OBJ
+ #define __KGR_PATCH(_name, _new_function, abort) { \
+ .name = #_name, \
+ .new_fun = _new_function, \
+ .abort_if_missing = abort, \
+ }
+
+ #undef KGR_PATCH
+
+ #define KGR_PATCH(_name, _new_function) \
+ __KGR_PATCH(_name, _new_function, true)
+ #define KGR_PATCH_OBJ(_name, _new_function, _objname) \
+ __KGR_PATCH(_name, _new_function, !_objname)
+ #define KGR_PATCH_OBJPOS(_name, _new_function, _objname, _sympos) \
+ __KGR_PATCH(_name, _new_function, !_objname)
+#endif
+
+#endif
diff --git a/kgr_patch_main.c b/kgr_patch_main.c
index 8167923..699aa6c 100644
--- a/kgr_patch_main.c
+++ b/kgr_patch_main.c
@@ -22,6 +22,8 @@
#include <linux/module.h>
#include <linux/types.h>
+#include "compat.h"
+
#include "uname_patch/kgr_patch_uname.h"
static struct kgr_patch patch = {
diff --git a/rpm/kgraft-patch.spec b/rpm/kgraft-patch.spec
index 3d1c8e6..6ee7443 100644
--- a/rpm/kgraft-patch.spec
+++ b/rpm/kgraft-patch.spec
@@ -29,6 +29,7 @@ Source1: Makefile
Source2: kgr_patch_main.c
Source3: config.sh
Source4: source-timestamp
+Source5: compat.h
BuildRequires: kernel-syms kgraft-devel
ExclusiveArch: s390x x86_64
%kgraft_module_package
@@ -42,6 +43,7 @@ This is a live patch for SUSE Linux Enterprise Server kernel.
%setup -c
cp %_sourcedir/kgr_patch_main.c .
cp %_sourcedir/Makefile .
+cp %_sourcedir/compat.h .
%build
sed -i 's/@@RPMRELEASE@@/%module_num/g' Makefile
diff --git a/scripts/tar-up.sh b/scripts/tar-up.sh
index 9b9597a..0b48420 100755
--- a/scripts/tar-up.sh
+++ b/scripts/tar-up.sh
@@ -76,6 +76,7 @@ install -m 644 kgr_patch_main.c $build_dir
install -m 644 Makefile $build_dir
install -m 644 rpm/kgraft-patch.spec $build_dir/kgraft-patch-"$RELEASE".spec
install -m 644 rpm/config.sh $build_dir/config.sh
+install -m 644 compat.h $build_dir
# timestamp
tsfile=source-timestamp