From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757188Ab3HGDqG (ORCPT ); Tue, 6 Aug 2013 23:46:06 -0400 Received: from mail-yh0-f48.google.com ([209.85.213.48]:36406 "EHLO mail-yh0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757153Ab3HGDpn (ORCPT ); Tue, 6 Aug 2013 23:45:43 -0400 From: Roy Franz To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, matt.fleming@intel.com, linux@arm.linux.org.uk Cc: leif.lindholm@linaro.org, dave.martin@arm.com, Roy Franz Subject: [PATCH 15/17] Add strstr to compressed string.c for ARM. Date: Tue, 6 Aug 2013 20:45:11 -0700 Message-Id: <1375847113-24884-16-git-send-email-roy.franz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> References: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The shared efi-stub-helper.c functions require a strstr implementation. Implementation copied from arch/x86/boot/string.c Signed-off-by: Roy Franz --- arch/arm/boot/compressed/string.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef..5397792 100644 --- a/arch/arm/boot/compressed/string.c +++ b/arch/arm/boot/compressed/string.c @@ -111,6 +111,27 @@ char *strchr(const char *s, int c) return (char *)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; +} #undef memset void *memset(void *s, int c, size_t count) -- 1.7.10.4 From mboxrd@z Thu Jan 1 00:00:00 1970 From: roy.franz@linaro.org (Roy Franz) Date: Tue, 6 Aug 2013 20:45:11 -0700 Subject: [PATCH 15/17] Add strstr to compressed string.c for ARM. In-Reply-To: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> References: <1375847113-24884-1-git-send-email-roy.franz@linaro.org> Message-ID: <1375847113-24884-16-git-send-email-roy.franz@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org The shared efi-stub-helper.c functions require a strstr implementation. Implementation copied from arch/x86/boot/string.c Signed-off-by: Roy Franz --- arch/arm/boot/compressed/string.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c index 36e53ef..5397792 100644 --- a/arch/arm/boot/compressed/string.c +++ b/arch/arm/boot/compressed/string.c @@ -111,6 +111,27 @@ char *strchr(const char *s, int c) return (char *)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; +} #undef memset void *memset(void *s, int c, size_t count) -- 1.7.10.4