From: Andreas Gruenbacher <agruen@suse.de>
To: linux-kernel@vger.kernel.org
Subject: [patch 2/3] Add match_string() for mount option parsing
Date: Wed, 06 Sep 2006 17:14:40 +0200 [thread overview]
Message-ID: <20060906151644.832424377@winden.suse.de> (raw)
In-Reply-To: <20060906151438.228071937@winden.suse.de>
[-- Attachment #1: parser-match_string.diff --]
[-- Type: text/plain, Size: 1678 bytes --]
The match_string() function allows to parse string constants in
mount options.
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Index: linux-2.6.18-rc6/include/linux/parser.h
===================================================================
--- linux-2.6.18-rc6.orig/include/linux/parser.h
+++ linux-2.6.18-rc6/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);
Index: linux-2.6.18-rc6/lib/parser.c
===================================================================
--- linux-2.6.18-rc6.orig/lib/parser.c
+++ linux-2.6.18-rc6/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
@@ -213,6 +226,7 @@ char *match_strdup(substring_t *s)
}
EXPORT_SYMBOL(match_token);
+EXPORT_SYMBOL(match_string);
EXPORT_SYMBOL(match_int);
EXPORT_SYMBOL(match_octal);
EXPORT_SYMBOL(match_hex);
--
Andreas Gruenbacher <agruen@suse.de>
SUSE Labs, SUSE LINUX Products GmbH / Novell Inc.
next prev parent reply other threads:[~2006-09-06 14:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-06 15:14 [patch 0/3] [RFC] NFSv4 ACLs on ext3 Andreas Gruenbacher
2006-09-06 15:14 ` [patch 1/3] Pass MAY_APPEND through to permission inode operations that understand it Andreas Gruenbacher
2006-09-06 15:14 ` Andreas Gruenbacher [this message]
2006-09-06 15:14 ` [patch 3/3] NFSv4 ACLs on ext3 Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060906151644.832424377@winden.suse.de \
--to=agruen@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®