函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\livepatch\shadow.c Create Date:2022-07-27 11:31:15
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__klp_shadow_get_or_alloc

函数原型:static void *__klp_shadow_get_or_alloc(void *obj, unsigned long id, size_t size, gfp_t gfp_flags, klp_shadow_ctor_t ctor, void *ctor_data, bool warn_on_exist)

返回类型:void

参数:

类型参数名称
void *obj
unsigned longid
size_tsize
gfp_tgfp_flags
klp_shadow_ctor_tctor
void *ctor_data
boolwarn_on_exist
114  shadow_data等于klp_shadow_get() - retrieve a shadow variable data pointer*@obj: pointer to parent object*@id: data identifier* Return: the shadow variable data element, NULL on failure.
115  如果shadow_data则转到:exists
123  new_shadow等于分配内存并置零
124  如果非new_shadow则返回:NULL
128  spin_lock_irqsave( & klp_shadow_lock provides exclusive access to the klp_shadow_hash and* the shadow variables it references., flags)
129  shadow_data等于klp_shadow_get() - retrieve a shadow variable data pointer*@obj: pointer to parent object*@id: data identifier* Return: the shadow variable data element, NULL on failure.
130  如果此条件成立可能性小(为编译器优化)(shadow_data)则
135  spin_unlock_irqrestore( & klp_shadow_lock provides exclusive access to the klp_shadow_hash and* the shadow variables it references., flags)
136  kfree(new_shadow)
137  转到:exists
140  obj等于obj
141  id等于id
143  如果ctor
146  err等于ctor(obj, data, ctor_data)
147  如果err
149  kfree(new_shadow)
150  打印错误信息("Failed to construct shadow variable <%p, %lx> (%d)\n", obj, id, err)
152  返回:NULL
157  hash_add_rcu - add an object to a rcu enabled hashtable*@hashtable: hashtable to add to*@node: the &struct hlist_node of the object to be added*@key: the key of the object to be added(klp_shadow_hash, & node, (unsignedlong)obj)
159  spin_unlock_irqrestore( & klp_shadow_lock provides exclusive access to the klp_shadow_hash and* the shadow variables it references., flags)
161  返回:data
163  exists :
164  如果warn_on_exist
165  WARN(1, "Duplicate shadow variable <%p, %lx>\n", obj, id)
166  返回:NULL
169  返回:shadow_data
调用者
名称描述
klp_shadow_allocklp_shadow_alloc() - allocate and add a new shadow variable*@obj: pointer to parent object*@id: data identifier*@size: size of attached data*@gfp_flags: GFP mask for allocation*@ctor: custom constructor to initialize the shadow data (optional)*@ctor_data:
klp_shadow_get_or_allocklp_shadow_get_or_alloc() - get existing or allocate a new shadow variable*@obj: pointer to parent object*@id: data identifier*@size: size of attached data*@gfp_flags: GFP mask for allocation*@ctor: custom constructor to initialize the shadow data