Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:parse_subpart

Proto:static int parse_subpart(struct cmdline_subpart **subpart, char *partdef)

Type:int

Parameter:

TypeParameterName
struct cmdline_subpart **subpart
char *partdef
13  ret = 0
16  * subpart = NULL
18  new_subpart = 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).
19  If Not new_subpart Then Return -ENOMEM
22  If partdef == '-' Then
23  size = ~0ULL
24  partdef++
25  Else
26  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
27  If size < PAGE_SIZE Then
28  pr_warn("cmdline partition size is invalid.")
29  ret = -EINVAL
30  Go to fail
34  If partdef == '@' Then
35  partdef++
36  from = 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
37  Else
38  from = ~0ULL
41  If partdef == '(' Then
43  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
45  If Not next Then
46  pr_warn("cmdline partition format is invalid.")
47  ret = -EINVAL
48  Go to fail
51  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 - partdef, size of partition name, such as 'rootfs' - 1)
53  strncpy( partition name, such as 'rootfs' , partdef, length)
54  partition name, such as 'rootfs' [length] = '\0'
56  partdef = ++next
57  Else partition name, such as 'rootfs' [0] = '\0'
60  flags = 0
62  If Not strncmp(partdef, "ro", 2) Then
63  flags |= Device is read only
64  partdef += 2
67  If Not strncmp(partdef, "lk", 2) Then
68  flags |= Always locked after reset
69  partdef += 2
72  subpart = new_subpart
73  Return 0
74  fail :
75  kfree(new_subpart)
76  Return ret
Caller
NameDescribe
parse_parts