Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:This function parses command lines in the format* crashkernel=ramsize-range:size[,...][@offset]* The function returns 0 on success and -EINVAL on failure.

Proto:static int __init parse_crashkernel_mem(char *cmdline, unsigned long long system_ram, unsigned long long *crash_size, unsigned long long *crash_base)

Type:int

Parameter:

TypeParameterName
char *cmdline
unsigned long longsystem_ram
unsigned long long *crash_size
unsigned long long *crash_base
41  cur = cmdline
44  Do
45  end = ULLONG_MAX
48  start = memparse - parse a string with mem suffixes into a number*@ptr: Where parse begins*@retptr: (output) Optional pointer to next char after parse completes* Parses a string into a number. The number stored at @ptr is
49  If cur == tmp Then
50  pr_warn("crashkernel: Memory value expected\n")
51  Return -EINVAL
53  cur = tmp
54  If cur != '-' Then
55  pr_warn("crashkernel: '-' expected\n")
56  Return -EINVAL
58  cur++
61  If cur != ':' Then
63  If cur == tmp Then
64  pr_warn("crashkernel: Memory value expected\n")
65  Return -EINVAL
67  cur = tmp
68  If end <= start Then
69  pr_warn("crashkernel: end <= start\n")
70  Return -EINVAL
74  If cur != ':' Then
75  pr_warn("crashkernel: ':' expected\n")
76  Return -EINVAL
78  cur++
80  size = memparse - parse a string with mem suffixes into a number*@ptr: Where parse begins*@retptr: (output) Optional pointer to next char after parse completes* Parses a string into a number. The number stored at @ptr is
81  If cur == tmp Then
82  pr_warn("Memory value expected\n")
83  Return -EINVAL
85  cur = tmp
86  If size >= system_ram Then
87  pr_warn("crashkernel: invalid size\n")
88  Return -EINVAL
92  If system_ram >= start && system_ram < end Then
93  crash_size = size
94  Break
96  When cur++ == ',' cycle
98  If crash_size > 0 Then
99  When cur && cur != ' ' && cur != '@' cycle
100  cur++
101  If cur == '@' Then
102  cur++
104  If cur == tmp Then
105  pr_warn("Memory value expected after '@'\n")
106  Return -EINVAL
109  Else pr_info("crashkernel size resulted in zero bytes\n")
112  Return 0
Caller
NameDescribe
__parse_crashkernel