diff options
| author | Jens Axboe <axboe@fb.com> | 2014-11-19 05:43:46 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2014-11-19 05:43:46 +0300 |
| commit | b3521729769ec71567a2e32a38609f87e781e41b (patch) | |
| tree | 66a8494968706420c3eb043caa5868702d440d18 /lib/cmdline.c | |
| parent | 139768895309c6c1d6913e909e9c9422f81a1640 (diff) | |
| parent | fc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff) | |
| download | linux-b3521729769ec71567a2e32a38609f87e781e41b.tar.xz | |
Merge branch 'master' into for-3.19/drivers
Diffstat (limited to 'lib/cmdline.c')
| -rw-r--r-- | lib/cmdline.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/cmdline.c b/lib/cmdline.c index 76a712e6e20e..8f13cf73c2ec 100644 --- a/lib/cmdline.c +++ b/lib/cmdline.c @@ -160,3 +160,32 @@ unsigned long long memparse(const char *ptr, char **retptr) return ret; } EXPORT_SYMBOL(memparse); + +/** + * parse_option_str - Parse a string and check an option is set or not + * @str: String to be parsed + * @option: option name + * + * This function parses a string containing a comma-separated list of + * strings like a=b,c. + * + * Return true if there's such option in the string, or return false. + */ +bool parse_option_str(const char *str, const char *option) +{ + while (*str) { + if (!strncmp(str, option, strlen(option))) { + str += strlen(option); + if (!*str || *str == ',') + return true; + } + + while (*str && *str != ',') + str++; + + if (*str == ',') + str++; + } + + return false; +} |
