core.h (a976c2951d8f376112361830aa7762beff83a205) | core.h (93862e385ded7c60351e09fcd2a541d273650905) |
---|---|
1#ifndef _LIVEPATCH_CORE_H 2#define _LIVEPATCH_CORE_H 3 | 1#ifndef _LIVEPATCH_CORE_H 2#define _LIVEPATCH_CORE_H 3 |
4#include <linux/livepatch.h> 5 |
|
4extern struct mutex klp_mutex; 5 | 6extern struct mutex klp_mutex; 7 |
8static inline bool klp_is_object_loaded(struct klp_object *obj) 9{ 10 return !obj->name || obj->mod; 11} 12 13static inline int klp_pre_patch_callback(struct klp_object *obj) 14{ 15 int ret; 16 17 ret = (obj->callbacks.pre_patch) ? 18 (*obj->callbacks.pre_patch)(obj) : 0; 19 20 obj->callbacks.post_unpatch_enabled = !ret; 21 22 return ret; 23} 24 25static inline void klp_post_patch_callback(struct klp_object *obj) 26{ 27 if (obj->callbacks.post_patch) 28 (*obj->callbacks.post_patch)(obj); 29} 30 31static inline void klp_pre_unpatch_callback(struct klp_object *obj) 32{ 33 if (obj->callbacks.pre_unpatch) 34 (*obj->callbacks.pre_unpatch)(obj); 35} 36 37static inline void klp_post_unpatch_callback(struct klp_object *obj) 38{ 39 if (obj->callbacks.post_unpatch_enabled && 40 obj->callbacks.post_unpatch) 41 (*obj->callbacks.post_unpatch)(obj); 42} 43 |
|
6#endif /* _LIVEPATCH_CORE_H */ | 44#endif /* _LIVEPATCH_CORE_H */ |