]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.suse/parser-match_string.diff
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / parser-match_string.diff
diff --git a/src/patches/suse-2.6.27.31/patches.suse/parser-match_string.diff b/src/patches/suse-2.6.27.31/patches.suse/parser-match_string.diff
new file mode 100644 (file)
index 0000000..912f25d
--- /dev/null
@@ -0,0 +1,55 @@
+From: Andreas Gruenbacher <agruen@suse.de>
+Subject: Add match_string() for mount option parsing
+References: FATE301275
+Patch-mainline: no
+
+The match_string() function allows to parse string constants in
+mount options.
+
+Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
+
+---
+ include/linux/parser.h |    1 +
+ lib/parser.c           |   14 ++++++++++++++
+ 2 files changed, 15 insertions(+)
+
+--- a/include/linux/parser.h
++++ b/include/linux/parser.h
+@@ -26,6 +26,7 @@ typedef struct {
+ } substring_t;
+ int match_token(char *, match_table_t table, substring_t args[]);
++int match_string(substring_t *s, const char *str);
+ int match_int(substring_t *, int *result);
+ int match_octal(substring_t *, int *result);
+ int match_hex(substring_t *, int *result);
+--- a/lib/parser.c
++++ b/lib/parser.c
+@@ -111,6 +111,19 @@ int match_token(char *s, match_table_t t
+ }
+ /**
++ * match_string: check for a particular parameter
++ * @s: substring to be scanned
++ * @str: string to scan for
++ *
++ * Description: Return if a &substring_t is equal to string @str.
++ */
++int match_string(substring_t *s, const char *str)
++{
++      return strlen(str) == s->to - s->from &&
++             !memcmp(str, s->from, s->to - s->from);
++}
++
++/**
+  * match_number: scan a number in the given base from a substring_t
+  * @s: substring to be scanned
+  * @result: resulting integer on success
+@@ -221,6 +234,7 @@ char *match_strdup(const substring_t *s)
+ }
+ EXPORT_SYMBOL(match_token);
++EXPORT_SYMBOL(match_string);
+ EXPORT_SYMBOL(match_int);
+ EXPORT_SYMBOL(match_octal);
+ EXPORT_SYMBOL(match_hex);