diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 19:12:33 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 19:12:33 -0800 |
commit | bcede2f64a3b5cb50c0bdec1553ab480fd75d659 (patch) | |
tree | b98e55bf2eea83bb5f6805abb210c5ea8625b550 /arch/x86/boot/string.c | |
parent | d0b9706c20ebb4ba181dc26e52ac9a6861abf425 (diff) | |
parent | 2d2da60fb40a80cc59383121ccf763e0e0e8a42a (diff) |
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86, efi: Break up large initrd reads
x86, efi: EFI boot stub support
efi: Add EFI file I/O data types
efi.h: Add boottime->locate_handle search types
efi.h: Add graphics protocol guids
efi.h: Add allocation types for boottime->allocate_pages()
efi.h: Add efi_image_loaded_t
efi.h: Add struct definition for boot time services
x86: Don't use magic strings for EFI loader signature
x86: Add missing bzImage fields to struct setup_header
Diffstat (limited to 'arch/x86/boot/string.c')
-rw-r--r-- | arch/x86/boot/string.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c index 3cbc4058dd2..574dedfe289 100644 --- a/arch/x86/boot/string.c +++ b/arch/x86/boot/string.c @@ -111,3 +111,38 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int bas return result; } + +/** + * strlen - Find the length of a string + * @s: The string to be sized + */ +size_t strlen(const char *s) +{ + const char *sc; + + for (sc = s; *sc != '\0'; ++sc) + /* nothing */; + return sc - s; +} + +/** + * strstr - Find the first substring in a %NUL terminated string + * @s1: The string to be searched + * @s2: The string to search for + */ +char *strstr(const char *s1, const char *s2) +{ + size_t l1, l2; + + l2 = strlen(s2); + if (!l2) + return (char *)s1; + l1 = strlen(s1); + while (l1 >= l2) { + l1--; + if (!memcmp(s1, s2, l2)) + return (char *)s1; + s1++; + } + return NULL; +} |