Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mtrr\if.c Create Date:2022-07-28 08:05:35
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:seq_file can seek but we ignore it.* Format of control line:* "base=%Lx size=%Lx type=%s" or "disable=%d"

Proto:static ssize_t mtrr_write(struct file *file, const char __user *buf, size_t len, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
const char __user *buf
size_tlen
loff_t *ppos
104  If Not Check operation authority Then Return -EPERM
107  memset(line, 0, LINE_SIZE)
109  len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(size_t, len, LINE_SIZE - 1)
110  length = Copy a NUL terminated string from userspace
111  If length < 0 Then Return length
114  linelen = strlen - Find the length of a string*@s: The string to be sized
115  ptr = line + linelen - 1
116  If linelen && ptr == '\n' Then ptr = '\0'
119  If Not strncmp(line, "disable=", 8) Then
120  reg = simple_strtoul - convert a string to an unsigned long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use* This function is obsolete. Please use kstrtoul instead.
121  err = mtrr_del_page - delete a memory type region*@reg: Register returned by mtrr_add*@base: Physical base address*@size: Size of region* If register is supplied then base and size are ignored. This is* how drivers should call it.* Releases an MTRR region
122  If err < 0 Then Return err
124  Return len
127  If strncmp(line, "base=", 5) Then Return -EINVAL
130  base = simple_strtoull - convert a string to an unsigned long long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use
131  ptr = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
133  If strncmp(ptr, "size=", 5) Then Return -EINVAL
136  size = simple_strtoull - convert a string to an unsigned long long*@cp: The start of the string*@endp: A pointer to the end of the parsed string will be placed here*@base: The number base to use
137  If base & 0xfff || size & 0xfff Then Return -EINVAL
139  ptr = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
141  If strncmp(ptr, "type=", 5) Then Return -EINVAL
143  ptr = skip_spaces - Removes leading whitespace from @str.*@str: The string to be stripped.* Returns a pointer to the first non-whitespace character in @str.
145  i = match_string - matches given string in an array*@array: array of strings*@n: number of strings in the array or -1 for NULL terminated arrays*@string: string to match with* Return:* index of a @string in the @array if matches, or %-EINVAL otherwise.
146  If i < 0 Then Return i
149  base >>= PAGE_SHIFT determines the page size
150  size >>= PAGE_SHIFT determines the page size
151  err = mtrr_add_page - Add a memory type region*@base: Physical base address of region in pages (in units of 4 kB!)*@size: Physical size of region in pages (4 kB)*@type: Type of MTRR desired*@increment: If this is true do usage counting on the region* Memory
152  If err < 0 Then Return err
154  Return len