From: Matthew Garrett <mjg@redhat.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, mikew@google.com, tony.luck@intel.com
Subject: [PATCH 7/9] efivars: introduce utf16_strncmp
Date: Mon, 18 Jul 2011 16:30:31 -0400 [thread overview]
Message-ID: <1311021033-7483-8-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1311021033-7483-1-git-send-email-mjg@redhat.com>
From: Mike Waychison <mikew@google.com>
Introduce utf16_strncmp which is used in the next patch. Semantics
should be the same as the strncmp C function.
Signed-off-by: Mike Waychison <mikew@google.com>
---
drivers/firmware/efivars.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index 4202a31..15b9a01 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -169,6 +169,24 @@ utf16_strsize(efi_char16_t *data, unsigned long maxlength)
return utf16_strnlen(data, maxlength/sizeof(efi_char16_t)) * sizeof(efi_char16_t);
}
+static inline int
+utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len)
+{
+ while (1) {
+ if (len == 0)
+ return 0;
+ if (*a < *b)
+ return -1;
+ if (*a > *b)
+ return 1;
+ if (*a == 0) /* implies *b == 0 */
+ return 0;
+ a++;
+ b++;
+ len--;
+ }
+}
+
static efi_status_t
get_var_data_locked(struct efivars *efivars, struct efi_variable *var)
{
--
1.7.6
next prev parent reply other threads:[~2011-07-18 20:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-18 20:30 Add an EFI pstore backend Matthew Garrett
2011-07-18 20:30 ` [PATCH 1/9] pstore: Extend API Matthew Garrett
2011-07-18 20:30 ` [PATCH 2/9] pstore: Add extra context for writes and erases Matthew Garrett
2011-07-18 20:30 ` [PATCH 3/9] pstore: Make "part" unsigned Matthew Garrett
2011-07-18 20:30 ` [PATCH 4/9] pstore: Allow the user to explicitly choose a backend Matthew Garrett
2011-07-18 20:58 ` Tony Luck
2011-07-18 21:00 ` Matthew Garrett
2011-07-18 21:08 ` Tony Luck
2011-07-20 13:27 ` Konrad Rzeszutek Wilk
2011-07-20 14:29 ` Luck, Tony
2011-07-18 20:30 ` [PATCH 5/9] efi: Add support for using efivars as a pstore backend Matthew Garrett
2011-07-18 20:30 ` [PATCH 6/9] efivars: String functions Matthew Garrett
2011-07-18 20:30 ` Matthew Garrett [this message]
2011-07-18 20:30 ` [PATCH 8/9] efivars: Use string functions in pstore_write Matthew Garrett
2011-07-18 20:30 ` [PATCH 9/9] efivars: Introduce PSTORE_EFI_ATTRIBUTES Matthew Garrett
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=1311021033-7483-8-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikew@google.com \
--cc=tony.luck@intel.com \
--cc=x86@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®