[RFC kgr on klp 3/9] livepatch: add klp_*_to_patch helpers

From: Jiri Slaby
Date: Mon May 04 2015 - 07:40:58 EST


This will be used in the kGraft-like patching.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
include/linux/livepatch.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index 31db7a05dd36..fabb067a3f1d 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -129,6 +129,16 @@ struct klp_patch {
#define klp_for_each_func(obj, func) \
for (func = obj->funcs; func->old_name; func++)

+static inline struct klp_patch *klp_func_to_patch(struct klp_func *func)
+{
+ return container_of(func->kobj.parent->parent, struct klp_patch, kobj);
+}
+
+static inline struct klp_patch *klp_object_to_patch(struct klp_object *obj)
+{
+ return container_of(obj->kobj.parent, struct klp_patch, kobj);
+}
+
int klp_register_patch(struct klp_patch *);
int klp_unregister_patch(struct klp_patch *);
int klp_enable_patch(struct klp_patch *);
--
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/