summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2014-10-04 01:15:56 +0400
committerMatt Fleming <matt.fleming@intel.com>2014-10-04 01:15:56 +0400
commit75b128573b275d5a5a7210b98c4b8cb3b39c12e7 (patch)
treee607db32fd303246ee9b93af83a611fc7b93479a /lib
parentfe82dcec644244676d55a1384c958d5f67979adb (diff)
parent7efe665903d0d963b0ebf4cab25cc3ae32c62600 (diff)
downloadlinux-75b128573b275d5a5a7210b98c4b8cb3b39c12e7.tar.xz
Merge branch 'next' into efi-next-merge
Conflicts: arch/x86/boot/compressed/eboot.c
Diffstat (limited to 'lib')
-rw-r--r--lib/cmdline.c29
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;
+}