Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4230003imj; Tue, 12 Feb 2019 12:05:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IbWWvUwGHmB225Pk+V7Jfi77kHMMuqCLaUXd3zMgHqFBi+paUB6r8PE36dmmdm5TTBMNkQY X-Received: by 2002:a17:902:bf44:: with SMTP id u4mr5729791pls.5.1550001921043; Tue, 12 Feb 2019 12:05:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550001921; cv=none; d=google.com; s=arc-20160816; b=FSy3i1usbc+N+7N4xMvTFq+R4QRSFKPGv1mqefWrQwf+8qDh8B7ka8RW0b+lENPbMF Xdc/goHr3Ckw3sJSyOroCABAwaqyZ0BjijGm5AjcLMLQHl9IJKBk8ijshB0awIeQAEnc WqghxQF9xVyLP+P7pQtWd9PemxhkYmX1SWNUBZXXsD+dLlEZ1HRV/tYCYs8fW+QQOPUL 6M1drBFtRY2Ve3KVkJPE5vd8Dx4sK0jxPfgOZNytakXRZb/y87JNpeJo9k2wRWdSjm1G w2fsYhDX2vj/HKgaWwSsJKONXVBeAdKvKFREHLr68Ch1AeUsk6UJzTdpXcydR9NG2oOh VbxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=qnPUxP4wkNN6G5QRmW//oRBq3wLHmYQB3mlfwK4ryDM=; b=fCLLXnyGv8NXpqOQeFVRoH+xrLqVgZ+92oVqeMg10GdPRwEgmVILrxZBpSb6tbjTEt OaNXVGeZ7O0euGDQY/pDCJlMoed6QX17Uat/CljNJZ2Yqg2LY3aM5rTAZRcF+MF+wGpz zlz03tw1FLDpimpECCo23R1ehEYRCdmTReVQ5rhf4Aulg2t+JL0xSbPvXY6YxJZxzeN7 uxdquBHKDA2g9/ZEUAVXYh2VWN0zeMyNFORFNrmc+ka8M0MLV5xU1xchayC8uEIJZi/n 7rpUKv77Hd1NyFlrxwPjN+2PshyfUEZ4LNn5Gb5IRlxiW93secJQiVaVYUDRHUDF0cEt RBBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HO7YHLoK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si10224385pgr.341.2019.02.12.12.05.04; Tue, 12 Feb 2019 12:05:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HO7YHLoK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731484AbfBLTTw (ORCPT + 99 others); Tue, 12 Feb 2019 14:19:52 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:34657 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728168AbfBLTTw (ORCPT ); Tue, 12 Feb 2019 14:19:52 -0500 Received: by mail-qt1-f194.google.com with SMTP id w4so4364461qtc.1 for ; Tue, 12 Feb 2019 11:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qnPUxP4wkNN6G5QRmW//oRBq3wLHmYQB3mlfwK4ryDM=; b=HO7YHLoK+xVG1emVvfpXQ9aAJa2GA5YSGTDKXo4qxPF6tK2AJP58pMI2B357U18Kxv yVRPTkQCjFUYaYUGIVNAJOQTt9UqbORXexG35/kgoqrCIQaVF0N8q5IWrFnlQfQCGPIc Z040i6f45h12VQmeNZrD3YwrrViKRdnlOGZxT/6h/6Pui4Vza5ZG1ZCWDUvkSN7TI5YJ poFX9GQRgmkJgwCCLN/VLh2OalwHoN74bMXMKVyAS1BH6/fguMi/tIkyvRQhadig2kPH UfI2WRNNcnluLsm5WXAWsolksbXcbvLCPaVQu2RqnB3CNBJ8s2YqzS3CAk0cgDL8+L4V rOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qnPUxP4wkNN6G5QRmW//oRBq3wLHmYQB3mlfwK4ryDM=; b=L07jZCF7a4m1PMAoARNqxGAi5SVOU6lYXZN8VQPDg5K0UMqyW2ZCBgORa2HQGAQawZ vixau/4RD1D5+TMifn2BgTadAsfcO4gyras4hjb4LRUWNv+fFHBliuJ4C2Jfm6Ef5W9G ycfWt4hPyVFAC+RbFHIFCB/2vEXoli1kY8SCWqGkzA2wKRDmAGMVqzK9AFs1ZR7QVrgd vMXnQAdbfTXu3OmdMqwtUqqQlya1MKzENjkCrqP/vSIfg4PCzV1uSSoB4YfveRyz37np 17IgOrMhoJHToxtAmHPtYc7bu5EkiGSuuMq2Dgtc32/UZG/u5ZSpwXgdO3z4Deol2qWS Fk5A== X-Gm-Message-State: AHQUAuaDz41XN6bg3olmrkVmfKrKLDZ/YFYTKtNRkOv0VfZMK5XhLqm2 0r92i72WdM7oC5U/FX6SRxjYRkKu1/+RCHe5LPg= X-Received: by 2002:a0c:d124:: with SMTP id a33mr3912345qvh.19.1549999191469; Tue, 12 Feb 2019 11:19:51 -0800 (PST) MIME-Version: 1.0 References: <1549994809-27479-1-git-send-email-xiaoxiang@xiaomi.com> <1549997683-27986-1-git-send-email-xiaoxiang@xiaomi.com> <20190212191219.GB22246@kroah.com> In-Reply-To: <20190212191219.GB22246@kroah.com> From: xiang xiao Date: Wed, 13 Feb 2019 03:19:40 +0800 Message-ID: Subject: Re: [v2] lib/string: add memrchr function To: Greg KH Cc: alexander.shishkin@linux.intel.com, andriy.shevchenko@linux.intel.com, linux-kernel@vger.kernel.org, Xiang Xiao Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 13, 2019 at 3:12 AM Greg KH wrote: > > On Wed, Feb 13, 2019 at 02:54:43AM +0800, Xiang Xiao wrote: > > Here is the detailed description for memrchr: > > > > void *memrchr(const void *s, int c, size_t n); > > > > The memrchr() function is like the memchr() function, except > > that it searches backward from the end of the n bytes pointed > > to by s instead of forward from the beginning. > > > > The memrchr() functions return a pointer to the matching byte > > or NULL if the character does not occur in the given memory > > area. > > > > Signed-off-by: Xiang Xiao > > --- > > include/linux/string.h | 1 + > > lib/string.c | 21 +++++++++++++++++++++ > > 2 files changed, 22 insertions(+) > > > > diff --git a/include/linux/string.h b/include/linux/string.h > > index 7927b87..f380f4b 100644 > > --- a/include/linux/string.h > > +++ b/include/linux/string.h > > @@ -167,6 +167,7 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt) > > memcpy(dst, src, cnt); > > } > > #endif > > +void *memrchr(const void *s, int c, size_t n); > > void *memchr_inv(const void *s, int c, size_t n); > > char *strreplace(char *s, char old, char new); > > Also, if you really need this, why not also provide the arch-specific > versions as well? > Good point, I will make the arch-specific overwrite possible. > thanks, > > greg k-h