summaryrefslogtreecommitdiff
path: root/kernel/livepatch/patch.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-27 22:26:44 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-06-27 22:26:44 +0200
commita976c2951d8f376112361830aa7762beff83a205 (patch)
tree24f6647aedd4b570cb67f3195962f5c8a040c824 /kernel/livepatch/patch.h
parent83848fbe7e6af978c080a88c130a67178b1ac0e4 (diff)
parent16b9951f656ea8f2b47546bd898325a7e256932f (diff)
Merge back ACPICA material for v4.13.
Diffstat (limited to 'kernel/livepatch/patch.h')
-rw-r--r--kernel/livepatch/patch.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/livepatch/patch.h b/kernel/livepatch/patch.h
new file mode 100644
index 000000000000..0db227170c36
--- /dev/null
+++ b/kernel/livepatch/patch.h
@@ -0,0 +1,33 @@
+#ifndef _LIVEPATCH_PATCH_H
+#define _LIVEPATCH_PATCH_H
+
+#include <linux/livepatch.h>
+#include <linux/list.h>
+#include <linux/ftrace.h>
+
+/**
+ * struct klp_ops - structure for tracking registered ftrace ops structs
+ *
+ * A single ftrace_ops is shared between all enabled replacement functions
+ * (klp_func structs) which have the same old_addr. This allows the switch
+ * between function versions to happen instantaneously by updating the klp_ops
+ * struct's func_stack list. The winner is the klp_func at the top of the
+ * func_stack (front of the list).
+ *
+ * @node: node for the global klp_ops list
+ * @func_stack: list head for the stack of klp_func's (active func is on top)
+ * @fops: registered ftrace ops struct
+ */
+struct klp_ops {
+ struct list_head node;
+ struct list_head func_stack;
+ struct ftrace_ops fops;
+};
+
+struct klp_ops *klp_find_ops(unsigned long old_addr);
+
+int klp_patch_object(struct klp_object *obj);
+void klp_unpatch_object(struct klp_object *obj);
+void klp_unpatch_objects(struct klp_patch *patch);
+
+#endif /* _LIVEPATCH_PATCH_H */