From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756690AbbBFQTM (ORCPT ); Fri, 6 Feb 2015 11:19:12 -0500 Received: from smtprelay0216.hostedemail.com ([216.40.44.216]:39688 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752647AbbBFQTL (ORCPT ); Fri, 6 Feb 2015 11:19:11 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::,RULES_HIT:41:69:355:379:541:599:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3870:3872:3874:4321:4605:5007:6261:7576:7875:8784:10004:10400:10848:10967:11026:11232:11473:11658:11914:12043:12291:12517:12519:12555:12683:12740:13069:13311:13357:14096:14097:14110:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: land01_4fceec4e3e962 X-Filterd-Recvd-Size: 2669 Date: Fri, 6 Feb 2015 11:19:07 -0500 From: Steven Rostedt To: Al Viro Cc: linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH v2 2/7] implement memmem() Message-ID: <20150206111907.6768ab49@gandalf.local.home> In-Reply-To: <1423195215-25134-2-git-send-email-viro@ZenIV.linux.org.uk> References: <20150205224632.GW29656@ZenIV.linux.org.uk> <1423195215-25134-2-git-send-email-viro@ZenIV.linux.org.uk> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Feb 2015 04:00:10 +0000 Al Viro wrote: > From: Al Viro > > Signed-off-by: Al Viro > --- > include/linux/string.h | 1 + > lib/string.c | 34 ++++++++++++++++++++++------------ > 2 files changed, 23 insertions(+), 12 deletions(-) > > diff --git a/include/linux/string.h b/include/linux/string.h > index 2e22a2e..87f9fba 100644 > --- a/include/linux/string.h > +++ b/include/linux/string.h > @@ -75,6 +75,7 @@ extern char * strstr(const char *, const char *); > #endif > #ifndef __HAVE_ARCH_STRNSTR > extern char * strnstr(const char *, const char *, size_t); > +extern void * memmem(const void *, size_t, const void *, size_t); > #endif > #ifndef __HAVE_ARCH_STRLEN > extern __kernel_size_t strlen(const char *); > diff --git a/lib/string.c b/lib/string.c > index 1006330..2035dbe 100644 > --- a/lib/string.c > +++ b/lib/string.c > @@ -740,27 +740,37 @@ EXPORT_SYMBOL(strstr); > #endif > > #ifndef __HAVE_ARCH_STRNSTR Although I do not see any archs that have this set, if one were to set it, then memmem() would also have to be implemented. Should this patch add a: #ifndef __HAVE_ARCH_MEMMEM ? -- Steve > + > /** > - * strnstr - Find the first substring in a length-limited string > + * memmem - Find the first length-limited substring in a length-limited string > * @s1: The string to be searched > + * @len1: the maximum number of characters to search > * @s2: The string to search for > - * @len: the maximum number of characters to search > + * @len2: the length of the string being searched > */ > -char *strnstr(const char *s1, const char *s2, size_t len) > +void *memmem(const void *s1, size_t len1, const void *s2, size_t len2) > {