Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\fail_function.c Create Date:2022-07-28 11:36:49
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fei_write

Proto:static ssize_t fei_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
const char __user *buffer
size_tcount
loff_t *ppos
248  If count > KSYM_NAME_LEN Then count = KSYM_NAME_LEN
250  buf = Allocation memory
251  If Not buf Then Return -ENOMEM
254  If copy_from_user(buf, buffer, count) Then
255  ret = -EFAULT
256  Go to out
258  buf[count] = '\0'
259  sym = strstrip(buf)
261  mutex_lock( & fei_lock)
264  If sym[0] == '\0' Then
265  fei_attr_remove_all()
266  ret = count
267  Go to out
270  If sym[0] == '!' Then
271  attr = fei_attr_lookup(sym + 1)
272  If Not attr Then
273  ret = -ENOENT
274  Go to out
276  fei_attr_remove(attr)
277  ret = count
278  Go to out
281  addr = Lookup the address for this symbol. Returns 0 if not found.
282  If Not addr Then
283  ret = -EINVAL
284  Go to out
286  If Not within_error_injection_list(addr) Then
287  ret = -ERANGE
288  Go to out
290  If fei_attr_lookup(sym) Then
291  ret = -EBUSY
292  Go to out
294  attr = fei_attr_new(sym, addr)
295  If Not attr Then
296  ret = -ENOMEM
297  Go to out
300  ret = register_kprobe( & kp)
301  If Not ret Then fei_debugfs_add_attr(attr)
303  If ret < 0 Then fei_attr_remove(attr)
305  Else
306  list_add_tail - add a new entry*@new: new entry to be added*@head: list head to add it before* Insert a new entry before the specified head.* This is useful for implementing queues.
307  ret = count
309  out :
310  kfree(buf)
311  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
312  Return ret