summaryrefslogtreecommitdiff
path: root/include/linux/livepatch.h
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2015-05-19 13:01:19 +0300
committerJiri Kosina <jkosina@suse.cz>2015-05-20 00:58:43 +0300
commit8cdd043ab32c2ff28d2a77c514a768a9edce244c (patch)
tree532e856e533309a4b22f22adadc31c5e45672252 /include/linux/livepatch.h
parentcad706df7e4a00a595f2662f32c0fc174aa4e61f (diff)
downloadlinux-8cdd043ab32c2ff28d2a77c514a768a9edce244c.tar.xz
livepatch: introduce patch/func-walking helpers
klp_for_each_object and klp_for_each_func are now used all over the code. One need not think what is the proper condition to check in the for loop now. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/livepatch.h')
-rw-r--r--include/linux/livepatch.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
index fe45f2f02c8d..31db7a05dd36 100644
--- a/include/linux/livepatch.h
+++ b/include/linux/livepatch.h
@@ -123,6 +123,12 @@ struct klp_patch {
enum klp_state state;
};
+#define klp_for_each_object(patch, obj) \
+ for (obj = patch->objs; obj->funcs; obj++)
+
+#define klp_for_each_func(obj, func) \
+ for (func = obj->funcs; func->old_name; func++)
+
int klp_register_patch(struct klp_patch *);
int klp_unregister_patch(struct klp_patch *);
int klp_enable_patch(struct klp_patch *);