linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roy Franz <roy.franz@linaro.org>
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, grant.likely@linaro.org,
	dave.martin@arm.com, msalter@redhat.com,
	Roy Franz <roy.franz@linaro.org>
Subject: [PATCH 3/6] Add strstr to compressed string.c for ARM.
Date: Sat, 28 Sep 2013 09:23:20 -0700	[thread overview]
Message-ID: <1380385403-31904-4-git-send-email-roy.franz@linaro.org> (raw)
In-Reply-To: <1380385403-31904-1-git-send-email-roy.franz@linaro.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 <roy.franz@linaro.org>
Reviewed-by: Grant Likely <grant.likely@linaro.org>
---
 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

  reply	other threads:[~2013-09-28 16:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-28 16:23 [PATCH V4 0/6] ADD ARM EFI stub Roy Franz
2013-09-28 16:23 ` Roy Franz [this message]
2013-09-28 16:23 ` [PATCH 4/6] Add EFI stub for ARM Roy Franz
     [not found] ` <1380385403-31904-1-git-send-email-roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-09-28 16:23   ` [PATCH 1/6] efi-stub.txt updates " Roy Franz
     [not found]     ` <1380385403-31904-2-git-send-email-roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-03  9:40       ` Matt Fleming
2013-09-28 16:23   ` [PATCH 2/6] Add shared update_fdt() function for ARM/ARM64 Roy Franz
     [not found]     ` <1380385403-31904-3-git-send-email-roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-10-03  9:52       ` Matt Fleming
     [not found]         ` <20131003095224.GX21381-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-10-03 13:43           ` Mark Salter
     [not found]             ` <1380807804.17503.9.camel-PDpCo7skNiwAicBL8TP8PQ@public.gmane.org>
2013-10-03 14:27               ` Matt Fleming
2013-10-03 14:57                 ` Mark Salter
2013-10-03 19:28                 ` Roy Franz
     [not found]                   ` <CAFECyb-=2osh_j_9FCnWjAjLX-xbzanQeFjCLNTz4JKAk5d30w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-03 21:07                     ` Matt Fleming
2013-09-28 16:23   ` [PATCH 5/6] Disable stack protection for decompressor/stub Roy Franz
2013-09-28 16:23   ` [PATCH 6/6] Add config EFI_STUB for ARM to Kconfig Roy Franz

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=1380385403-31904-4-git-send-email-roy.franz@linaro.org \
    --to=roy.franz@linaro.org \
    --cc=dave.martin@arm.com \
    --cc=grant.likely@linaro.org \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=matt.fleming@intel.com \
    --cc=msalter@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).