Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\fsopen.c Create Date:2022-07-28 20:13:26
Last Modify:2022-05-24 07:35:12 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Allow the user to read back any error, warning or informational messages.

Proto:static ssize_t fscontext_read(struct file *file, char __user *_buf, size_t len, loff_t *pos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
char __user *_buf
size_tlen
loff_t *pos
27  fc = needed for tty driver, and maybe others
28  log = log
29  logsize = ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(buffer)
35  ret = mutex_lock_interruptible( & uapi_mutex)
36  If ret < 0 Then Return ret
39  If Insertion index in buffer[] == Removal index in buffer[] Then
40  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.
41  Return -ENODATA
44  index = Removal index in buffer[] & logsize - 1
45  p = buffer[index]
46  need_free = Mask of kfree'able items in buffer[] & 1 << index
47  buffer[index] = NULL
48  Mask of kfree'able items in buffer[] &= ~(1 << index)
49  Removal index in buffer[] ++
50  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.
52  ret = -EMSGSIZE
53  n = strlen - Find the length of a string*@s: The string to be sized
54  If n > len Then Go to err_free
56  ret = -EFAULT
57  If copy_to_user(_buf, p, n) != 0 Then Go to err_free
59  ret = n
61  err_free :
62  If need_free Then kfree(p)
64  Return ret