Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Find a non-boolean option, that is, "option=argument". In accordance* with standard Linux practice, if this option is repeated, this returns* the last instance on the command line.* Returns the length of the argument (regardless of if it was

Proto:int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *buffer, int bufsize)

Type:int

Parameter:

TypeParameterName
unsigned longcmdline_ptr
const char *option
char *buffer
intbufsize
32  len = -1
33  const char * opptr = NULL
34  bufptr = buffer
35  enum{st_wordstart, st_wordcmp, st_wordskip, st_bufcpy}state = st_wordstart
42  If Not cmdline_ptr Then Return -1
45  cptr = cmdline_ptr & 0xf
46  set_fs(cmdline_ptr >> 4)
48  When cptr < 0x10000 && (c = rdfs8(cptr++)) cycle
50  Case state == st_wordstart
55  state = st_wordcmp
56  opptr = option
59  Case state == st_wordcmp
60  If c == '=' && Not opptr Then
61  len = 0
62  bufptr = buffer
63  state = st_bufcpy
66  Else if c != opptr++ Then
69  Break
71  Case state == st_wordskip
74  Break
76  Case state == st_bufcpy
79  Else
80  If len < bufsize - 1 Then bufptr++ = c
82  len++
84  Break
88  If bufsize Then bufptr = '\0'
91  Return len
Caller
NameDescribe
cmdline_find_option