Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LIVEPATCH_PATCH_H
0003 #define _LIVEPATCH_PATCH_H
0004 
0005 #include <linux/livepatch.h>
0006 #include <linux/list.h>
0007 #include <linux/ftrace.h>
0008 
0009 /**
0010  * struct klp_ops - structure for tracking registered ftrace ops structs
0011  *
0012  * A single ftrace_ops is shared between all enabled replacement functions
0013  * (klp_func structs) which have the same old_func.  This allows the switch
0014  * between function versions to happen instantaneously by updating the klp_ops
0015  * struct's func_stack list.  The winner is the klp_func at the top of the
0016  * func_stack (front of the list).
0017  *
0018  * @node:   node for the global klp_ops list
0019  * @func_stack: list head for the stack of klp_func's (active func is on top)
0020  * @fops:   registered ftrace ops struct
0021  */
0022 struct klp_ops {
0023     struct list_head node;
0024     struct list_head func_stack;
0025     struct ftrace_ops fops;
0026 };
0027 
0028 struct klp_ops *klp_find_ops(void *old_func);
0029 
0030 int klp_patch_object(struct klp_object *obj);
0031 void klp_unpatch_object(struct klp_object *obj);
0032 void klp_unpatch_objects(struct klp_patch *patch);
0033 void klp_unpatch_objects_dynamic(struct klp_patch *patch);
0034 
0035 #endif /* _LIVEPATCH_PATCH_H */