diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-02-13 20:42:37 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-03-08 03:23:40 -0500 |
commit | c349cdcaba589fb49cf105093ebc695eb8b9ff08 (patch) | |
tree | 0ab3165baae80dbfed236b5e2c23afd3d14ba14d /kernel/livepatch/patch.h | |
parent | aa82dc3e00da63751bb9dfab26983037b79fc39d (diff) |
livepatch: move patching functions into patch.c
Move functions related to the actual patching of functions and objects
into a new patch.c file.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'kernel/livepatch/patch.h')
-rw-r--r-- | kernel/livepatch/patch.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kernel/livepatch/patch.h b/kernel/livepatch/patch.h new file mode 100644 index 000000000000..2d0cce02dade --- /dev/null +++ b/kernel/livepatch/patch.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef _LIVEPATCH_PATCH_H | ||
2 | #define _LIVEPATCH_PATCH_H | ||
3 | |||
4 | #include <linux/livepatch.h> | ||
5 | #include <linux/list.h> | ||
6 | #include <linux/ftrace.h> | ||
7 | |||
8 | /** | ||
9 | * struct klp_ops - structure for tracking registered ftrace ops structs | ||
10 | * | ||
11 | * A single ftrace_ops is shared between all enabled replacement functions | ||
12 | * (klp_func structs) which have the same old_addr. This allows the switch | ||
13 | * between function versions to happen instantaneously by updating the klp_ops | ||
14 | * struct's func_stack list. The winner is the klp_func at the top of the | ||
15 | * func_stack (front of the list). | ||
16 | * | ||
17 | * @node: node for the global klp_ops list | ||
18 | * @func_stack: list head for the stack of klp_func's (active func is on top) | ||
19 | * @fops: registered ftrace ops struct | ||
20 | */ | ||
21 | struct klp_ops { | ||
22 | struct list_head node; | ||
23 | struct list_head func_stack; | ||
24 | struct ftrace_ops fops; | ||
25 | }; | ||
26 | |||
27 | struct klp_ops *klp_find_ops(unsigned long old_addr); | ||
28 | |||
29 | int klp_patch_object(struct klp_object *obj); | ||
30 | void klp_unpatch_object(struct klp_object *obj); | ||
31 | |||
32 | #endif /* _LIVEPATCH_PATCH_H */ | ||