Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:parse_parts

Proto:static int parse_parts(struct cmdline_parts **parts, const char *bdevdef)

Type:int

Parameter:

TypeParameterName
struct cmdline_parts **parts
const char *bdevdef
92  ret = -EINVAL
99  * parts = NULL
101  newparts = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
102  If Not newparts Then Return -ENOMEM
105  next = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
106  If Not next Then
107  pr_warn("cmdline partition has no block device.")
108  Go to fail
111  length = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, next - bdevdef, size of block device, such as 'mmcblk0' - 1)
112  strncpy( block device, such as 'mmcblk0' , bdevdef, length)
113  block device, such as 'mmcblk0' [length] = '\0'
114  nr_subparts = 0
116  next_subpart = subpart
118  When next && *++next cycle
119  bdevdef = next
120  next = strchr - Find the first occurrence of the character c in the string s.*@s: the string to be searched*@c: the character to search for
122  length = If Not next Then size of buf - 1 Else min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, next - bdevdef, size of buf - 1)
125  strncpy(buf, bdevdef, length)
126  buf[length] = '\0'
128  ret = parse_subpart(next_subpart, buf)
129  If ret Then Go to fail
132  nr_subparts++
133  next_subpart = next_subpart
136  If Not subpart Then
137  pr_warn("cmdline partition has no valid partition.")
138  ret = -EINVAL
139  Go to fail
142  parts = newparts
144  Return 0
145  fail :
146  free_subpart(newparts)
147  kfree(newparts)
148  Return ret
Caller
NameDescribe
cmdline_parts_parse