From patchwork Thu Apr 1 10:19:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 381FBC433B4 for ; Thu, 1 Apr 2021 10:19:34 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5C4961056 for ; Thu, 1 Apr 2021 10:19:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5C4961056 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104280.199268 (Exim 4.92) (envelope-from ) id 1lRuQ5-0000cb-12; Thu, 01 Apr 2021 10:19:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104280.199268; Thu, 01 Apr 2021 10:19:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQ4-0000cU-U2; Thu, 01 Apr 2021 10:19:20 +0000 Received: by outflank-mailman (input) for mailman id 104280; Thu, 01 Apr 2021 10:19:19 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQ3-0000cP-CY for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:19:19 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 18698b2d-322e-4a69-a3c1-ecbb84983cfa; Thu, 01 Apr 2021 10:19:18 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A60E8AED7; Thu, 1 Apr 2021 10:19:17 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 18698b2d-322e-4a69-a3c1-ecbb84983cfa X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272357; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9n+mI1T3eTMXqMQfpWtBTAwMJf+lLEmiOgcGI7/pMvs=; b=VFOQcT58NhjmucUyXOze1BHcqSKPdeJjv3E34UTJrUjtwxeQfDuqavnRIX+nBI4z/KGdQe hriJ50IRFM26dH19iKmqiAfkJQvnV8lW02MQB4ItZMfR/wAXt4eQ2mCRw8gsKACHjnSiQO bSmgHjUlLNKDEbVFv/j+z0liIoNsclg= Subject: [PATCH 01/23] lib: move muldiv64() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:19:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Make this a separate archive member under lib/. While doing so, don't move latently broken x86 assembly though: Fix the constraints, such that properly extending inputs to 64-bit won't just be a side effect of needing to copy registers, and such that we won't fail to clobber %rdx. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -393,35 +393,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 * } #endif /* BITS_PER_LONG == 32 */ -/* Compute with 96 bit intermediate result: (a*b)/c */ -uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) -{ -#ifdef CONFIG_X86 - asm ( "mul %%rdx; div %%rcx" : "=a" (a) : "0" (a), "d" (b), "c" (c) ); - return a; -#else - union { - uint64_t ll; - struct { -#ifdef WORDS_BIGENDIAN - uint32_t high, low; -#else - uint32_t low, high; -#endif - } l; - } u, res; - uint64_t rl, rh; - - u.ll = a; - rl = (uint64_t)u.l.low * (uint64_t)b; - rh = (uint64_t)u.l.high * (uint64_t)b; - rh += (rl >> 32); - res.l.high = rh / c; - res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; - return res.ll; -#endif -} - /* * Local variables: * mode: C --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y += bsearch.o lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o +lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o --- /dev/null +++ b/xen/lib/muldiv64.c @@ -0,0 +1,44 @@ +#include + +/* Compute with 96 bit intermediate result: (a*b)/c */ +uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) +{ +#ifdef CONFIG_X86 + asm ( "mulq %1; divq %2" : "+a" (a) + : "rm" ((uint64_t)b), "rm" ((uint64_t)c) + : "rdx" ); + + return a; +#else + union { + uint64_t ll; + struct { +#ifdef WORDS_BIGENDIAN + uint32_t high, low; +#else + uint32_t low, high; +#endif + } l; + } u, res; + uint64_t rl, rh; + + u.ll = a; + rl = (uint64_t)u.l.low * (uint64_t)b; + rh = (uint64_t)u.l.high * (uint64_t)b; + rh += (rl >> 32); + res.l.high = rh / c; + res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; + + return res.ll; +#endif +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Thu Apr 1 10:19:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177693 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62B88C433ED for ; Thu, 1 Apr 2021 10:20:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CCC261056 for ; Thu, 1 Apr 2021 10:20:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CCC261056 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104284.199281 (Exim 4.92) (envelope-from ) id 1lRuQY-0000kK-E2; Thu, 01 Apr 2021 10:19:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104284.199281; Thu, 01 Apr 2021 10:19:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQY-0000kD-AD; Thu, 01 Apr 2021 10:19:50 +0000 Received: by outflank-mailman (input) for mailman id 104284; Thu, 01 Apr 2021 10:19:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQW-0000k1-GV for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:19:48 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ac7ed814-87d3-4e11-827f-e838f7f435b3; Thu, 01 Apr 2021 10:19:47 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B0B5DAEAE; Thu, 1 Apr 2021 10:19:46 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac7ed814-87d3-4e11-827f-e838f7f435b3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MQq09dPyj92+Q29K/+2WpJlVyL1zFTQmPSHsHxroQCM=; b=asLWaYr+GzD+ctulBCqcr5J1Pe6NlJBNsZZSHGyEMskY7CGokeFC6ereCgztYhN+LJS5L3 iqA17xOzmzD6PcwQkMoN6dtghYvW8jzyEIXEpbYh67YB99mimu85p+6KWTfPEUHTI6Li/s 7EL87fAUJW/u9aIMMBtOnW+gEv4oo4k= Subject: [PATCH 02/23] lib: move 64-bit div/mod compiler helpers From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: Message-ID: <0fec827f-bb0b-4ea1-7757-9c27e9138be7@suse.com> Date: Thu, 1 Apr 2021 12:19:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US These were built for 32-bit architectures only (the same code could, with some tweaking, sensibly be used to provide TI-mode helpers on 64-bit arch-es) - retain this property, while still avoiding to have a CU without any contents at all. For this, Arm's CONFIG_64BIT gets generalized. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- xen/arch/Kconfig | 2 ++ xen/arch/arm/Kconfig | 12 +++--------- xen/arch/x86/Kconfig | 1 + xen/common/Makefile | 1 - xen/lib/Makefile | 4 ++++ xen/{common/lib.c => lib/divmod.c} | 2 -- 6 files changed, 10 insertions(+), 12 deletions(-) rename xen/{common/lib.c => lib/divmod.c} (99%) diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig index d144d4c8d3ee..f16eb0df43af 100644 --- a/xen/arch/Kconfig +++ b/xen/arch/Kconfig @@ -1,3 +1,5 @@ +config 64BIT + bool config NR_CPUS int "Maximum number of CPUs" diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 330bbf6232d4..ecfa6822e4d3 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -1,17 +1,11 @@ -config 64BIT - bool - default "$(ARCH)" != "arm32" - help - Say yes to build a 64-bit Xen - Say no to build a 32-bit Xen - config ARM_32 def_bool y - depends on !64BIT + depends on "$(ARCH)" = "arm32" config ARM_64 def_bool y - depends on 64BIT + depends on !ARM_32 + select 64BIT select HAS_FAST_MULTIPLY config ARM diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index f79e6634db3f..4d6911ffa467 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -1,5 +1,6 @@ config X86_64 def_bool y + select 64BIT config X86 def_bool y diff --git a/xen/common/Makefile b/xen/common/Makefile index 71c1d466bd8f..e2a7e62d14bf 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -21,7 +21,6 @@ obj-y += kernel.o obj-y += keyhandler.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC) += kimage.o -obj-y += lib.o obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o obj-$(CONFIG_MEM_ACCESS) += mem_access.o obj-y += memory.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 0b274583ef0b..a5dc1442a422 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -10,3 +10,7 @@ lib-y += rbtree.o lib-y += sort.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o + +lib32-y := divmod.o +lib32-$(CONFIG_64BIT) := +lib-y += $(lib32-y) diff --git a/xen/common/lib.c b/xen/lib/divmod.c similarity index 99% rename from xen/common/lib.c rename to xen/lib/divmod.c index 5b8f49153dad..0be6ccc70096 100644 --- a/xen/common/lib.c +++ b/xen/lib/divmod.c @@ -40,7 +40,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#if BITS_PER_LONG == 32 /* * Depending on the desired operation, we view a `long long' (aka quad_t) in @@ -391,7 +390,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 *r) else return quot; } -#endif /* BITS_PER_LONG == 32 */ /* * Local variables: From patchwork Thu Apr 1 10:20:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36203C433ED for ; Thu, 1 Apr 2021 10:20:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DE3796108B for ; Thu, 1 Apr 2021 10:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DE3796108B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104288.199293 (Exim 4.92) (envelope-from ) id 1lRuR3-0001Xp-Mf; Thu, 01 Apr 2021 10:20:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104288.199293; Thu, 01 Apr 2021 10:20:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuR3-0001Xh-Je; Thu, 01 Apr 2021 10:20:21 +0000 Received: by outflank-mailman (input) for mailman id 104288; Thu, 01 Apr 2021 10:20:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuR2-0001Xa-CN for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:20:20 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4a2154c3-18a5-4c48-9603-4d3dc9c13d9b; Thu, 01 Apr 2021 10:20:19 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 811A6AE86; Thu, 1 Apr 2021 10:20:18 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4a2154c3-18a5-4c48-9603-4d3dc9c13d9b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPkeQToxrrrMgDYsF5+OEyCjKJhGCfAdjAB1QD105BY=; b=pfFcnH7t3pM/LgBQSszXHdKaTOpO8A45FuPaoYHiidjH6Asav228TrSkkL1WHsKLfaAb7a OtU+tsrVNsMAgMIqSHAhk7SubEazHg82ELaucIDsPkQGfd7ZjSFHUiODCMWpdZz+fWfwg3 rBZzvFL6dFw8K76vw6y1FLMMFB3FuT4= Subject: [PATCH 03/23] string: drop redundant declarations From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:20:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US These standard functions shouldn't need custom declarations. The only case where redundancy might be needed is if there were inline functions there. But we don't have any here (anymore). Prune the per-arch headers of duplicate declarations while moving the asm/string.h inclusion past the declarations. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- a/xen/include/asm-arm/string.h +++ b/xen/include/asm-arm/string.h @@ -8,41 +8,21 @@ */ #define __HAVE_ARCH_STRRCHR -char *strrchr(const char *s, int c); - #define __HAVE_ARCH_STRCHR -char *strchr(const char *s, int c); - #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_STRCMP -int strcmp(const char *, const char *); - #define __HAVE_ARCH_STRNCMP -int strncmp(const char *, const char *, size_t); - #define __HAVE_ARCH_STRLEN -size_t strlen(const char *); - #define __HAVE_ARCH_STRNLEN -size_t strnlen(const char *, size_t); #endif #define __HAVE_ARCH_MEMCPY -void *memcpy(void *, const void *, size_t); - #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_MEMCMP -int memcmp(const void *, const void *, size_t); #endif - #define __HAVE_ARCH_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); - #define __HAVE_ARCH_MEMSET -void *memset(void *, int, size_t); - #define __HAVE_ARCH_MEMCHR -void *memchr(const void *, int, size_t); #if defined(CONFIG_ARM_32) --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -2,15 +2,12 @@ #define __X86_STRING_H__ #define __HAVE_ARCH_MEMCPY -void *memcpy(void *dest, const void *src, size_t n); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) #define __HAVE_ARCH_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); #define memmove(d, s, n) __builtin_memmove(d, s, n) #define __HAVE_ARCH_MEMSET -void *memset(void *dest, int c, size_t n); #define memset(s, c, n) __builtin_memset(s, c, n) #endif /* __X86_STRING_H__ */ --- a/xen/include/xen/string.h +++ b/xen/include/xen/string.h @@ -4,11 +4,6 @@ #include /* for size_t */ /* - * Include machine specific inline routines - */ -#include - -/* * These string functions are considered too dangerous for normal use. * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate. */ @@ -17,97 +12,78 @@ #define strncpy __xen_has_no_strncpy__ #define strncat __xen_has_no_strncat__ -#ifndef __HAVE_ARCH_STRLCPY size_t strlcpy(char *, const char *, size_t); -#endif - -#ifndef __HAVE_ARCH_STRLCAT size_t strlcat(char *, const char *, size_t); -#endif +int strcmp(const char *, const char *); +int strncmp(const char *, const char *, size_t); +int strnicmp(const char *, const char *, size_t); +int strcasecmp(const char *, const char *); +char *strchr(const char *, int); +char *strrchr(const char *, int); +char *strstr(const char *, const char *); +size_t strlen(const char *); +size_t strnlen(const char *, size_t); +char *strpbrk(const char *, const char *); +char *strsep(char **, const char *); +size_t strspn(const char *, const char *); + +void *memset(void *, int, size_t); +void *memcpy(void *, const void *, size_t); +void *memmove(void *, const void *, size_t); +int memcmp(const void *, const void *, size_t); +void *memchr(const void *, int, size_t); +void *memchr_inv(const void *, int, size_t); + +#include #ifndef __HAVE_ARCH_STRCMP -int strcmp(const char *, const char *); #define strcmp(s1, s2) __builtin_strcmp(s1, s2) #endif #ifndef __HAVE_ARCH_STRNCMP -int strncmp(const char *, const char *, size_t); #define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n) #endif -#ifndef __HAVE_ARCH_STRNICMP -int strnicmp(const char *, const char *, size_t); -#endif - #ifndef __HAVE_ARCH_STRCASECMP -int strcasecmp(const char *, const char *); #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2) #endif #ifndef __HAVE_ARCH_STRCHR -char *strchr(const char *, int); #define strchr(s1, c) __builtin_strchr(s1, c) #endif #ifndef __HAVE_ARCH_STRRCHR -char *strrchr(const char *, int); #define strrchr(s1, c) __builtin_strrchr(s1, c) #endif #ifndef __HAVE_ARCH_STRSTR -char *strstr(const char *, const char *); #define strstr(s1, s2) __builtin_strstr(s1, s2) #endif #ifndef __HAVE_ARCH_STRLEN -size_t strlen(const char *); #define strlen(s1) __builtin_strlen(s1) #endif -#ifndef __HAVE_ARCH_STRNLEN -size_t strnlen(const char *, size_t); -#endif - -#ifndef __HAVE_ARCH_STRPBRK -char *strpbrk(const char *, const char *); -#endif - -#ifndef __HAVE_ARCH_STRSEP -char *strsep(char **, const char *); -#endif - -#ifndef __HAVE_ARCH_STRSPN -size_t strspn(const char *, const char *); -#endif - - #ifndef __HAVE_ARCH_MEMSET -void *memset(void *, int, size_t); #define memset(s, c, n) __builtin_memset(s, c, n) #endif #ifndef __HAVE_ARCH_MEMCPY -void *memcpy(void *, const void *, size_t); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) #endif #ifndef __HAVE_ARCH_MEMMOVE -void *memmove(void *, const void *, size_t); #define memmove(d, s, n) __builtin_memmove(d, s, n) #endif #ifndef __HAVE_ARCH_MEMCMP -int memcmp(const void *, const void *, size_t); #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n) #endif #ifndef __HAVE_ARCH_MEMCHR -void *memchr(const void *, int, size_t); #define memchr(s, c, n) __builtin_memchr(s, c, n) #endif -void *memchr_inv(const void *, int, size_t); - #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[]) /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */ From patchwork Thu Apr 1 10:20:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C2DC43460 for ; Thu, 1 Apr 2021 10:21:11 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 28B52610A5 for ; Thu, 1 Apr 2021 10:21:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28B52610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104291.199305 (Exim 4.92) (envelope-from ) id 1lRuRb-0001ec-Vg; Thu, 01 Apr 2021 10:20:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104291.199305; Thu, 01 Apr 2021 10:20:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuRb-0001eV-So; Thu, 01 Apr 2021 10:20:55 +0000 Received: by outflank-mailman (input) for mailman id 104291; Thu, 01 Apr 2021 10:20:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuRa-0001eO-T3 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:20:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d9035512-b6ab-4b7c-a279-ff6205c89325; Thu, 01 Apr 2021 10:20:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2A61DAE86; Thu, 1 Apr 2021 10:20:53 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d9035512-b6ab-4b7c-a279-ff6205c89325 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y/o0dWVTmD5cz4sBu9wV/IeNaEozXqujf7L4dzcBth8=; b=aK2cPZfJgJb2HHd8yK6Jibspp8y4aisZQvoNWVYGymyoY6ijt9wLNdxwTyIKvZFxtLdv+o QAQaUex2GZ995R2gecrbyNVqqtRv070ZYy3hKGAbZLLDGUvPh2lPDnCSlqPCCFXnDMV7CQ QMxhhTKl3tEQLQYc0kf41ZKztgCB/7g= Subject: [PATCH 04/23] lib: move memset() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:20:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -#ifndef __HAVE_ARCH_MEMSET -/** - * memset - Fill a region of memory with the given value - * @s: Pointer to the start of the area. - * @c: The byte to fill the area with - * @count: The size of the area. - * - * Do not use memset() to access IO space, use memset_io() instead. - */ -void *(memset)(void *s, int c, size_t count) -{ - char *xs = (char *) s; - - while (count--) - *xs++ = c; - - return s; -} -#endif - #ifndef __HAVE_ARCH_MEMCPY /** * memcpy - Copy one area of memory to another --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -7,9 +7,6 @@ #define __HAVE_ARCH_MEMMOVE #define memmove(d, s, n) __builtin_memmove(d, s, n) -#define __HAVE_ARCH_MEMSET -#define memset(s, c, n) __builtin_memset(s, c, n) - #endif /* __X86_STRING_H__ */ /* * Local variables: --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y += bsearch.o lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o +lib-y += memset.o lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o --- /dev/null +++ b/xen/lib/memset.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memset - Fill a region of memory with the given value + * @s: Pointer to the start of the area. + * @c: The byte to fill the area with + * @count: The size of the area. + * + * Do not use memset() to access IO space, use memset_io() instead. + */ +void *(memset)(void *s, int c, size_t count) +{ + char *xs = (char *) s; + + while (count--) + *xs++ = c; + + return s; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:21:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ADD8C433B4 for ; Thu, 1 Apr 2021 10:21:30 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AC8B610A5 for ; Thu, 1 Apr 2021 10:21:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AC8B610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104295.199317 (Exim 4.92) (envelope-from ) id 1lRuS2-0001n9-8D; Thu, 01 Apr 2021 10:21:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104295.199317; Thu, 01 Apr 2021 10:21:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuS2-0001n2-4v; Thu, 01 Apr 2021 10:21:22 +0000 Received: by outflank-mailman (input) for mailman id 104295; Thu, 01 Apr 2021 10:21:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuS1-0001mn-Ch for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:21:21 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4101fc9f-d401-4964-a52b-166a26fb6c06; Thu, 01 Apr 2021 10:21:20 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CDE0CB0B6; Thu, 1 Apr 2021 10:21:19 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4101fc9f-d401-4964-a52b-166a26fb6c06 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oN+5vP1FCboLBZxZsCScrYUIPf9aJGtajya1l3gxAwM=; b=FvApu/I4xypS6JzaAEaRD3XXPxi2osemKQLvUHQR6rGAud2b9yn/Nk+wJ6oTuoJKlfCBDp wkdLc2NQ1C1INi03PVMetko0NXakIvXDidyMENaJ7iD0BxN62VKLlZLJK7nAmcowcyZD0Q dFA/ionmnepy6LUwJRmF3OcwbJp0VuE= Subject: [PATCH 05/23] lib: move memcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:21:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,27 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -#ifndef __HAVE_ARCH_MEMCPY -/** - * memcpy - Copy one area of memory to another - * @dest: Where to copy to - * @src: Where to copy from - * @count: The size of the area. - * - * You should not use this function to access IO space, use memcpy_toio() - * or memcpy_fromio() instead. - */ -void *(memcpy)(void *dest, const void *src, size_t count) -{ - char *tmp = (char *) dest, *s = (char *) src; - - while (count--) - *tmp++ = *s++; - - return dest; -} -#endif - #ifndef __HAVE_ARCH_MEMMOVE /** * memmove - Copy one area of memory to another --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -1,9 +1,6 @@ #ifndef __X86_STRING_H__ #define __X86_STRING_H__ -#define __HAVE_ARCH_MEMCPY -#define memcpy(d, s, n) __builtin_memcpy(d, s, n) - #define __HAVE_ARCH_MEMMOVE #define memmove(d, s, n) __builtin_memmove(d, s, n) --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y += bsearch.o lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o +lib-y += memcpy.o lib-y += memset.o lib-y += muldiv64.o lib-y += parse-size.o --- /dev/null +++ b/xen/lib/memcpy.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memcpy - Copy one area of memory to another + * @dest: Where to copy to + * @src: Where to copy from + * @count: The size of the area. + * + * You should not use this function to access IO space, use memcpy_toio() + * or memcpy_fromio() instead. + */ +void *(memcpy)(void *dest, const void *src, size_t count) +{ + char *tmp = (char *) dest, *s = (char *) src; + + while (count--) + *tmp++ = *s++; + + return dest; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:21:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3390C433ED for ; Thu, 1 Apr 2021 10:21:58 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DA79610A5 for ; Thu, 1 Apr 2021 10:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DA79610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104298.199329 (Exim 4.92) (envelope-from ) id 1lRuSU-0001u2-IN; Thu, 01 Apr 2021 10:21:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104298.199329; Thu, 01 Apr 2021 10:21:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuSU-0001tv-Eh; Thu, 01 Apr 2021 10:21:50 +0000 Received: by outflank-mailman (input) for mailman id 104298; Thu, 01 Apr 2021 10:21:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuST-0001tl-ED for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:21:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 74a238bc-faa6-4588-a8a9-7155f24fd142; Thu, 01 Apr 2021 10:21:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B82A5AEA6; Thu, 1 Apr 2021 10:21:47 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 74a238bc-faa6-4588-a8a9-7155f24fd142 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272507; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UlwL2DZgk5QMsxjKNY14U9Y4Ed0W95Lps/NjFQlhkyk=; b=kaDKC3HL34Id+gFUhxYyLvm99yhF4rXxMW7FIMhuxPTmBQiRmF3wmZ6EAe/0VgSE1bg0k7 sjlZn/fYs59zGaFD57At7atwibjezKifjFh5+D1MSUMYqwwwNMrJkAm95y3awCiDl9JBV6 rbnSbyOADKk+T2dJVYMBvg5oGLClW34= Subject: [PATCH 06/23] lib: move memmove() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: Message-ID: <36449347-69e8-b963-597f-c9359207cf57@suse.com> Date: Thu, 1 Apr 2021 12:21:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,36 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -#ifndef __HAVE_ARCH_MEMMOVE -/** - * memmove - Copy one area of memory to another - * @dest: Where to copy to - * @src: Where to copy from - * @count: The size of the area. - * - * Unlike memcpy(), memmove() copes with overlapping areas. - */ -void *(memmove)(void *dest, const void *src, size_t count) -{ - char *tmp, *s; - - if (dest <= src) { - tmp = (char *) dest; - s = (char *) src; - while (count--) - *tmp++ = *s++; - } - else { - tmp = (char *) dest + count; - s = (char *) src + count; - while (count--) - *--tmp = *--s; - } - - return dest; -} -#endif - #ifndef __HAVE_ARCH_MEMCMP /** * memcmp - Compare two areas of memory --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -1,9 +1,6 @@ #ifndef __X86_STRING_H__ #define __X86_STRING_H__ -#define __HAVE_ARCH_MEMMOVE -#define memmove(d, s, n) __builtin_memmove(d, s, n) - #endif /* __X86_STRING_H__ */ /* * Local variables: --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -5,6 +5,7 @@ lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o lib-y += memcpy.o +lib-y += memmove.o lib-y += memset.o lib-y += muldiv64.o lib-y += parse-size.o --- /dev/null +++ b/xen/lib/memmove.c @@ -0,0 +1,42 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memmove - Copy one area of memory to another + * @dest: Where to copy to + * @src: Where to copy from + * @count: The size of the area. + * + * Unlike memcpy(), memmove() copes with overlapping areas. + */ +void *(memmove)(void *dest, const void *src, size_t count) +{ + char *tmp, *s; + + if (dest <= src) { + tmp = (char *) dest; + s = (char *) src; + while (count--) + *tmp++ = *s++; + } else { + tmp = (char *) dest + count; + s = (char *) src + count; + while (count--) + *--tmp = *--s; + } + + return dest; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:22:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41E10C433ED for ; Thu, 1 Apr 2021 10:22:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C40396108B for ; Thu, 1 Apr 2021 10:22:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C40396108B Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104301.199341 (Exim 4.92) (envelope-from ) id 1lRuT5-00022C-Qt; Thu, 01 Apr 2021 10:22:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104301.199341; Thu, 01 Apr 2021 10:22:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuT5-000225-ND; Thu, 01 Apr 2021 10:22:27 +0000 Received: by outflank-mailman (input) for mailman id 104301; Thu, 01 Apr 2021 10:22:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuT3-00021n-UA for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:22:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4fb8832f-be95-4d20-ae58-4b50e73d5c12; Thu, 01 Apr 2021 10:22:25 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7CFFAAEA6; Thu, 1 Apr 2021 10:22:24 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4fb8832f-be95-4d20-ae58-4b50e73d5c12 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272544; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e1kdSAKEAN16LJljjXzIk1aT1zZrsyx9ENiy36Xyzo4=; b=nRlQ+tI8dRA9xfib5Ur7UyMrq1n3GB4VeMrC6gyOVKmf3Zt4PdU4K/t8wvc1PHLd/VBtoS F6J1I3Ut7Ddqt8uy5ZlE1jQxTJ8fm5S4cum06Pnu8hG2N6ISsYnOEbti+Bebgk0uBLbC3e Uc68mOTctRb8XUG6lKVk5Xz1W7OecHI= Subject: [PATCH 07/23] lib: move memcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:22:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,25 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -#ifndef __HAVE_ARCH_MEMCMP -/** - * memcmp - Compare two areas of memory - * @cs: One area of memory - * @ct: Another area of memory - * @count: The size of the area. - */ -int (memcmp)(const void *cs, const void *ct, size_t count) -{ - const unsigned char *su1, *su2; - int res = 0; - - for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) - if ((res = *su1 - *su2) != 0) - break; - return res; -} -#endif - #ifndef __HAVE_ARCH_MEMCHR /** * memchr - Find a character in an area of memory. --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y += bsearch.o lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o +lib-y += memcmp.o lib-y += memcpy.o lib-y += memmove.o lib-y += memset.o --- /dev/null +++ b/xen/lib/memcmp.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memcmp - Compare two areas of memory + * @cs: One area of memory + * @ct: Another area of memory + * @count: The size of the area. + */ +int (memcmp)(const void *cs, const void *ct, size_t count) +{ + const unsigned char *su1, *su2; + int res = 0; + + for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) + if ((res = *su1 - *su2) != 0) + break; + return res; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:22:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 498C4C433B4 for ; Thu, 1 Apr 2021 10:22:54 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8DD6610A5 for ; Thu, 1 Apr 2021 10:22:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8DD6610A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104304.199353 (Exim 4.92) (envelope-from ) id 1lRuTO-00028j-72; Thu, 01 Apr 2021 10:22:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104304.199353; Thu, 01 Apr 2021 10:22:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTO-00028a-3b; Thu, 01 Apr 2021 10:22:46 +0000 Received: by outflank-mailman (input) for mailman id 104304; Thu, 01 Apr 2021 10:22:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTN-00028Q-FU for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:22:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1ac8f106-5911-401b-9a4a-e6bb748213bf; Thu, 01 Apr 2021 10:22:44 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C0F65AEA6; Thu, 1 Apr 2021 10:22:43 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1ac8f106-5911-401b-9a4a-e6bb748213bf X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272563; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KxBFJAZ2KdhCH/22RG50f65pG/J6rh981un4Qrrk7qs=; b=uOPVgUllDCy67MY+92BXsz4sL3+4fgw2GNxlRoKLLRqhOEXjpirWugQoKc3gsNO2LlXkmC FBABYsIsKCE0VhREqQFbix1lgQ1FJlnQ9Dt5FUr+do9hQGAZuFY3gpG/fBhtVAh0dMPYHl ReMYzkvJ2zFymUS/MLAa3ZD4XX6NxtE= Subject: [PATCH 08/23] lib: move memchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:22:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,28 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -#ifndef __HAVE_ARCH_MEMCHR -/** - * memchr - Find a character in an area of memory. - * @s: The memory area - * @c: The byte to search for - * @n: The size of the area. - * - * returns the address of the first occurrence of @c, or %NULL - * if @c is not found - */ -void *(memchr)(const void *s, int c, size_t n) -{ - const unsigned char *p = s; - - while (n--) - if ((unsigned char)c == *p++) - return (void *)(p - 1); - - return NULL; -} -#endif - /** * memchr_inv - Find an unmatching character in an area of memory. * @s: The memory area --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y += bsearch.o lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o +lib-y += memchr.o lib-y += memcmp.o lib-y += memcpy.o lib-y += memmove.o --- /dev/null +++ b/xen/lib/memchr.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memchr - Find a character in an area of memory. + * @s: The memory area + * @c: The byte to search for + * @n: The size of the area. + * + * returns the address of the first occurrence of @c, or %NULL + * if @c is not found + */ +void *(memchr)(const void *s, int c, size_t n) +{ + const unsigned char *p = s; + + while (n--) + if ((unsigned char)c == *p++) + return (void *)(p - 1); + + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:23:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DA9AC433ED for ; Thu, 1 Apr 2021 10:23:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F25D606A5 for ; Thu, 1 Apr 2021 10:23:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F25D606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104309.199365 (Exim 4.92) (envelope-from ) id 1lRuTm-0002Fy-Gj; Thu, 01 Apr 2021 10:23:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104309.199365; Thu, 01 Apr 2021 10:23:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTm-0002Fr-Dc; Thu, 01 Apr 2021 10:23:10 +0000 Received: by outflank-mailman (input) for mailman id 104309; Thu, 01 Apr 2021 10:23:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTl-0002Ep-1a for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:09 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5993ffe6-787f-475b-b7ec-368f2c9a3671; Thu, 01 Apr 2021 10:23:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1529BAED7; Thu, 1 Apr 2021 10:23:07 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5993ffe6-787f-475b-b7ec-368f2c9a3671 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272587; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5742tdH/lAsOCplYSlX/aqstUJg8Rlv97TdWNCdRmSk=; b=ANROaimZWyzPlbs+4BeRDilkJtvIDsazHfGxSUcZuaQRhSHX2z0Sjb4Bb/sOszH8YVl/lX PH6jFzbeGidL4IhDn7Gyi6zXcWSZFqKKxFmhYaCw6iNB74mjlsJniiTasoOgEV94SxvN6a 0W8/f1ceznKvCPDD+VZsPlyDN7H/Zbw= Subject: [PATCH 09/23] lib: move memchr_inv() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:23:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif -/** - * memchr_inv - Find an unmatching character in an area of memory. - * @s: The memory area - * @c: The byte that is expected - * @n: The size of the area. - * - * returns the address of the first occurrence of a character other than @c, - * or %NULL if the whole buffer contains just @c. - */ -void *memchr_inv(const void *s, int c, size_t n) -{ - const unsigned char *p = s; - - while (n--) - if ((unsigned char)c != *p++) - return (void *)(p - 1); - - return NULL; -} - /* * Local variables: * mode: C --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -5,6 +5,7 @@ lib-y += ctors.o lib-y += ctype.o lib-y += list-sort.o lib-y += memchr.o +lib-y += memchr_inv.o lib-y += memcmp.o lib-y += memcpy.o lib-y += memmove.o --- /dev/null +++ b/xen/lib/memchr_inv.c @@ -0,0 +1,35 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * memchr_inv - Find an unmatching character in an area of memory. + * @s: The memory area + * @c: The byte that is expected + * @n: The size of the area. + * + * returns the address of the first occurrence of a character other than @c, + * or %NULL if the whole buffer contains just @c. + */ +void *memchr_inv(const void *s, int c, size_t n) +{ + const unsigned char *p = s; + + while (n--) + if ((unsigned char)c != *p++) + return (void *)(p - 1); + + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55DD4C433B4 for ; Thu, 1 Apr 2021 10:23:40 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ED359610CD for ; Thu, 1 Apr 2021 10:23:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED359610CD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104313.199389 (Exim 4.92) (envelope-from ) id 1lRuU7-0002RT-3d; Thu, 01 Apr 2021 10:23:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104313.199389; Thu, 01 Apr 2021 10:23:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuU6-0002RM-W1; Thu, 01 Apr 2021 10:23:30 +0000 Received: by outflank-mailman (input) for mailman id 104313; Thu, 01 Apr 2021 10:23:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuU5-0002Qp-2l for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:29 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8f259c5c-d47e-4d74-96f7-75188448331c; Thu, 01 Apr 2021 10:23:28 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A5E6EAE86; Thu, 1 Apr 2021 10:23:27 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8f259c5c-d47e-4d74-96f7-75188448331c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272607; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBbweA3vL9rMSj+WwvAqtgbZp6SBSyR96p37O2EqfpE=; b=IQTMtGb9knfLlR5xxb9YeGf2M90KdEeJ9v8Ftz46dP/kUuwkZXjOhWzJkGswOBSTUCJpBJ qoLEbyC1jamnFozUKQzTW3yJed1Db/gbrVZZ5GxQNAj0SUeG63ki/MPWA8wZZBH0u96CV8 NDJGkjmZiVUdEszQX1pKTw9IDzrSbKY= Subject: [PATCH 10/23] lib: move strlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <7e82929a-5eb0-a8a2-ec61-005311d74b44@suse.com> Date: Thu, 1 Apr 2021 12:23:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -184,21 +184,6 @@ char *(strrchr)(const char *s, int c) } #endif -#ifndef __HAVE_ARCH_STRLEN -/** - * 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; -} -#endif - #ifndef __HAVE_ARCH_STRNLEN /** * strnlen - Find the length of a length-limited string --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -14,6 +14,7 @@ lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o +lib-y += strlen.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strlen.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * 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; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:23:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D65BC433ED for ; Thu, 1 Apr 2021 10:24:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEE39610CF for ; Thu, 1 Apr 2021 10:24:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEE39610CF Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104317.199401 (Exim 4.92) (envelope-from ) id 1lRuUQ-0002YZ-Bq; Thu, 01 Apr 2021 10:23:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104317.199401; Thu, 01 Apr 2021 10:23:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUQ-0002YR-8V; Thu, 01 Apr 2021 10:23:50 +0000 Received: by outflank-mailman (input) for mailman id 104317; Thu, 01 Apr 2021 10:23:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUP-0002YB-I4 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 59e2009a-f191-4924-ab52-1b2717c39cc9; Thu, 01 Apr 2021 10:23:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1AD7AAED7; Thu, 1 Apr 2021 10:23:48 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 59e2009a-f191-4924-ab52-1b2717c39cc9 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j90++h3cFk0QIuXtJzchPhaTge5uMVq3pz3OcoqtqAs=; b=ebPsdQB4HSGKgTai3XRPrGo+eMQXtcbAZIZt9BxS4EYl3absZHxQG6icjnL5RDhQ8fwJji 9yXRzYmkqNx8BXROayS9GwPh9ZtYsedsECPgeRzSaTok0HZogjEl8YTJRU3QfKxNsIH543 2yS9bsH6KoCa2lY3k5pImfBgf90tt4I= Subject: [PATCH 11/23] lib: move strnlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <4545723a-44ec-6586-79bd-7b7f8442619b@suse.com> Date: Thu, 1 Apr 2021 12:23:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -184,22 +184,6 @@ char *(strrchr)(const char *s, int c) } #endif -#ifndef __HAVE_ARCH_STRNLEN -/** - * strnlen - Find the length of a length-limited string - * @s: The string to be sized - * @count: The maximum number of bytes to search - */ -size_t strnlen(const char * s, size_t count) -{ - const char *sc; - - for (sc = s; count-- && *sc != '\0'; ++sc) - /* nothing */; - return sc - s; -} -#endif - #ifndef __HAVE_ARCH_STRSPN /** * strspn - Calculate the length of the initial substring of @s which only --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -15,6 +15,7 @@ lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o lib-y += strlen.o +lib-y += strnlen.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strnlen.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strnlen - Find the length of a length-limited string + * @s: The string to be sized + * @count: The maximum number of bytes to search + */ +size_t strnlen(const char * s, size_t count) +{ + const char *sc; + + for (sc = s; count-- && *sc != '\0'; ++sc) + /* nothing */; + return sc - s; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:24:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02041C43460 for ; Thu, 1 Apr 2021 10:24:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9C6B7606A5 for ; Thu, 1 Apr 2021 10:24:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9C6B7606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104320.199413 (Exim 4.92) (envelope-from ) id 1lRuUm-0002g2-NE; Thu, 01 Apr 2021 10:24:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104320.199413; Thu, 01 Apr 2021 10:24:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUm-0002fv-J0; Thu, 01 Apr 2021 10:24:12 +0000 Received: by outflank-mailman (input) for mailman id 104320; Thu, 01 Apr 2021 10:24:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUl-0002fc-07 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:24:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9ce87208-548f-49a6-90ca-36c4304d5841; Thu, 01 Apr 2021 10:24:10 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 68116AED7; Thu, 1 Apr 2021 10:24:09 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9ce87208-548f-49a6-90ca-36c4304d5841 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NE7O51HBJ2kdFYFTIPJPJoUwkO79zqoySamP2nD1/Go=; b=E84cAT4Yqg1Gf6SKjQef8xh6xzWV+j2HJbYS/kPrH9y6E0819qvAtThuQ6tkhcHT9dv5yn VDu7pyMoUSo9Zy6Qed+wTfOlp7hjnAeA34eKcwKOHJbt9YuivQUy2NEd5CNTWn9CbUm0VK MtkniYyrLZfDRYCigd2gVp4nPIYvjw0= Subject: [PATCH 12/23] lib: move strcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <0b66b9ff-72c0-b645-87a7-13883e046d1f@suse.com> Date: Thu, 1 Apr 2021 12:24:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -111,25 +111,6 @@ size_t strlcat(char *dest, const char *s EXPORT_SYMBOL(strlcat); #endif -#ifndef __HAVE_ARCH_STRCMP -/** - * strcmp - Compare two strings - * @cs: One string - * @ct: Another string - */ -int (strcmp)(const char *cs, const char *ct) -{ - register signed char __res; - - while (1) { - if ((__res = *cs - *ct++) != 0 || !*cs++) - break; - } - - return __res; -} -#endif - #ifndef __HAVE_ARCH_STRNCMP /** * strncmp - Compare two length-limited strings --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -14,6 +14,7 @@ lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o +lib-y += strcmp.o lib-y += strlen.o lib-y += strnlen.o lib-$(CONFIG_X86) += xxhash32.o --- /dev/null +++ b/xen/lib/strcmp.c @@ -0,0 +1,32 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strcmp - Compare two strings + * @cs: One string + * @ct: Another string + */ +int (strcmp)(const char *cs, const char *ct) +{ + register signed char __res; + + while (1) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + } + + return __res; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:25:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E70C433B4 for ; Thu, 1 Apr 2021 10:25:16 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C498A610CA for ; Thu, 1 Apr 2021 10:25:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C498A610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104326.199425 (Exim 4.92) (envelope-from ) id 1lRuVc-0002sP-4b; Thu, 01 Apr 2021 10:25:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104326.199425; Thu, 01 Apr 2021 10:25:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVc-0002sI-1Q; Thu, 01 Apr 2021 10:25:04 +0000 Received: by outflank-mailman (input) for mailman id 104326; Thu, 01 Apr 2021 10:25:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVa-0002s8-Va for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ce857047-d00c-4769-9c5d-97dcbe6962e9; Thu, 01 Apr 2021 10:25:01 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2B45EAE86; Thu, 1 Apr 2021 10:25:01 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ce857047-d00c-4769-9c5d-97dcbe6962e9 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vdu1McyqjuuA+MC/um/kTIQJPhtl9yF8EaqHekvmKgo=; b=r6/NqASRM1dJYwp/MXnaampOR5t9AvcCQ/kvOT3tlATyaTFwO99W525Cl83vqSo0mRRjaq BKmsSK3P+FtfMGcv9DvdS4TeC1+6etDbjKx9/X/NngjkOVjohiG1Woy+lqlSadpj4miVuB 7LGHkVDYoSHPBpggcEBLaAYTZ5b/6e4= Subject: [PATCH 13/23] lib: move strncmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -111,27 +111,6 @@ size_t strlcat(char *dest, const char *s EXPORT_SYMBOL(strlcat); #endif -#ifndef __HAVE_ARCH_STRNCMP -/** - * strncmp - Compare two length-limited strings - * @cs: One string - * @ct: Another string - * @count: The maximum number of bytes to compare - */ -int (strncmp)(const char *cs, const char *ct, size_t count) -{ - register signed char __res = 0; - - while (count) { - if ((__res = *cs - *ct++) != 0 || !*cs++) - break; - count--; - } - - return __res; -} -#endif - #ifndef __HAVE_ARCH_STRCHR /** * strchr - Find the first occurrence of a character in a string --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -16,6 +16,7 @@ lib-y += rbtree.o lib-y += sort.o lib-y += strcmp.o lib-y += strlen.o +lib-y += strncmp.o lib-y += strnlen.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strncmp.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strncmp - Compare two length-limited strings + * @cs: One string + * @ct: Another string + * @count: The maximum number of bytes to compare + */ +int (strncmp)(const char *cs, const char *ct, size_t count) +{ + register signed char __res = 0; + + while (count) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + count--; + } + + return __res; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:25:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C5FAC433B4 for ; Thu, 1 Apr 2021 10:25:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0DA8610CA for ; Thu, 1 Apr 2021 10:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0DA8610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104329.199437 (Exim 4.92) (envelope-from ) id 1lRuVz-0002yS-Cf; Thu, 01 Apr 2021 10:25:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104329.199437; Thu, 01 Apr 2021 10:25:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVz-0002yK-9a; Thu, 01 Apr 2021 10:25:27 +0000 Received: by outflank-mailman (input) for mailman id 104329; Thu, 01 Apr 2021 10:25:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVx-0002xc-Dv for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 036094cf-81b8-4011-b6db-fe890cd78cbc; Thu, 01 Apr 2021 10:25:20 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D8D0EB032; Thu, 1 Apr 2021 10:25:19 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 036094cf-81b8-4011-b6db-fe890cd78cbc X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4XwCcLrzETyMlxHJ7JOlZs5KVV79sUmD+2c2kdGaHMA=; b=C2+qIz97TYYRdaJ9CP7uqEwCvbZdml6YmzF5BZWsFZ44auIKOPBkDrUPwA4Yo3E3l0Z1zS yi2W7ZvuhJYTywOlHaCsP8f9vtCkja3IZfjAQgn9gpfHI83sWBkrGslU3hTiuPTO0T8ezt YR/UJJGm5GWHNuW2LQlTWsgVoYkKrLI= Subject: [PATCH 14/23] lib: move strlcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -56,32 +56,6 @@ int (strcasecmp)(const char *s1, const c } #endif -#ifndef __HAVE_ARCH_STRLCPY -/** - * strlcpy - Copy a %NUL terminated string into a sized buffer - * @dest: Where to copy the string to - * @src: Where to copy the string from - * @size: size of destination buffer - * - * Compatible with *BSD: the result is always a valid - * NUL-terminated string that fits in the buffer (unless, - * of course, the buffer size is zero). It does not pad - * out the result like strncpy() does. - */ -size_t strlcpy(char *dest, const char *src, size_t size) -{ - size_t ret = strlen(src); - - if (size) { - size_t len = (ret >= size) ? size-1 : ret; - memcpy(dest, src, len); - dest[len] = '\0'; - } - return ret; -} -EXPORT_SYMBOL(strlcpy); -#endif - #ifndef __HAVE_ARCH_STRLCAT /** * strlcat - Append a %NUL terminated string into a sized buffer --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -15,6 +15,7 @@ lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o lib-y += strcmp.o +lib-y += strlcpy.o lib-y += strlen.o lib-y += strncmp.o lib-y += strnlen.o --- /dev/null +++ b/xen/lib/strlcpy.c @@ -0,0 +1,38 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strlcpy - Copy a %NUL terminated string into a sized buffer + * @dest: Where to copy the string to + * @src: Where to copy the string from + * @size: size of destination buffer + * + * Compatible with *BSD: the result is always a valid + * NUL-terminated string that fits in the buffer (unless, + * of course, the buffer size is zero). It does not pad + * out the result like strncpy() does. + */ +size_t strlcpy(char *dest, const char *src, size_t size) +{ + size_t ret = strlen(src); + + if (size) { + size_t len = (ret >= size) ? size-1 : ret; + memcpy(dest, src, len); + dest[len] = '\0'; + } + return ret; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:25:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48BB3C433B4 for ; Thu, 1 Apr 2021 10:25:49 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC3F8610CA for ; Thu, 1 Apr 2021 10:25:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DC3F8610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104331.199449 (Exim 4.92) (envelope-from ) id 1lRuWC-00033W-M4; Thu, 01 Apr 2021 10:25:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104331.199449; Thu, 01 Apr 2021 10:25:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWC-00033O-Ir; Thu, 01 Apr 2021 10:25:40 +0000 Received: by outflank-mailman (input) for mailman id 104331; Thu, 01 Apr 2021 10:25:39 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWB-000337-PI for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:39 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 677c0a98-d866-4d9b-8b1c-3e8a1ba29d84; Thu, 01 Apr 2021 10:25:38 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2C59AAE86; Thu, 1 Apr 2021 10:25:38 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 677c0a98-d866-4d9b-8b1c-3e8a1ba29d84 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272738; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7zV0Im6IiPxLCpobC1iQxqhPYJiA+5gcc1UKfDC95jE=; b=qIHew1rsKfuK2G8m4BneQjMHSn9siyKtHP3DEuIQq+5oQ1nJmQe+9C7nowdbf14CV0WPRy etbSo5fCeiotdcA1wIInQqazlEfXO1VD0T9Ry7knf37V9+41Dm7TpLxn7KbayQHofmtlsE p46FEbFxVz1EMvN4NvzMZGJH7SMAMQ4= Subject: [PATCH 15/23] lib: move strlcat() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -56,35 +56,6 @@ int (strcasecmp)(const char *s1, const c } #endif -#ifndef __HAVE_ARCH_STRLCAT -/** - * strlcat - Append a %NUL terminated string into a sized buffer - * @dest: Where to copy the string to - * @src: Where to copy the string from - * @size: size of destination buffer - * - * Compatible with *BSD: the result is always a valid - * NUL-terminated string that fits in the buffer (unless, - * of course, the buffer size is zero). - */ -size_t strlcat(char *dest, const char *src, size_t size) -{ - size_t slen = strlen(src); - size_t dlen = strnlen(dest, size); - char *p = dest + dlen; - - while ((p - dest) < size) - if ((*p++ = *src++) == '\0') - break; - - if (dlen < size) - *(p-1) = '\0'; - - return slen + dlen; -} -EXPORT_SYMBOL(strlcat); -#endif - #ifndef __HAVE_ARCH_STRCHR /** * strchr - Find the first occurrence of a character in a string --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -15,6 +15,7 @@ lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o lib-y += strcmp.o +lib-y += strlcat.o lib-y += strlcpy.o lib-y += strlen.o lib-y += strncmp.o --- /dev/null +++ b/xen/lib/strlcat.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strlcat - Append a %NUL terminated string into a sized buffer + * @dest: Where to copy the string to + * @src: Where to copy the string from + * @size: size of destination buffer + * + * Compatible with *BSD: the result is always a valid + * NUL-terminated string that fits in the buffer (unless, + * of course, the buffer size is zero). + */ +size_t strlcat(char *dest, const char *src, size_t size) +{ + size_t slen = strlen(src); + size_t dlen = strnlen(dest, size); + char *p = dest + dlen; + + while ((p - dest) < size) + if ((*p++ = *src++) == '\0') + break; + + if (dlen < size) + *(p-1) = '\0'; + + return slen + dlen; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:25:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3833C433ED for ; Thu, 1 Apr 2021 10:26:12 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7469E606A5 for ; Thu, 1 Apr 2021 10:26:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7469E606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104335.199460 (Exim 4.92) (envelope-from ) id 1lRuWa-0003BU-0L; Thu, 01 Apr 2021 10:26:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104335.199460; Thu, 01 Apr 2021 10:26:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWZ-0003BN-TY; Thu, 01 Apr 2021 10:26:03 +0000 Received: by outflank-mailman (input) for mailman id 104335; Thu, 01 Apr 2021 10:26:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWY-00039I-FF for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:02 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 02ab72af-98ca-4dc6-a62f-7c7dc437c736; Thu, 01 Apr 2021 10:25:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 525B3AEA6; Thu, 1 Apr 2021 10:25:57 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 02ab72af-98ca-4dc6-a62f-7c7dc437c736 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272757; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JFsPHBSFCRbpswM140dIBX+K0lYDWe8o/0ZUhNbUxao=; b=sGJ4tbmKIwfb/xiCiCgT6875Pw/IKeNIwYR5si/L2whCsOoKqVFH1PA4xmzr4ohBkZ064U j+3tXw6o3Hyon76EnJ5IIg2TECUlaApHLOhDcMbl+OeKrqdikZDTzZSZfiWgWES9/c4t/T 94hpE5DenHFl9dCJp3cKyAp22WQT8jM= Subject: [PATCH 16/23] lib: move strchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -56,21 +56,6 @@ int (strcasecmp)(const char *s1, const c } #endif -#ifndef __HAVE_ARCH_STRCHR -/** - * strchr - Find the first occurrence of a character in a string - * @s: The string to be searched - * @c: The character to search for - */ -char *(strchr)(const char *s, int c) -{ - for(; *s != (char) c; ++s) - if (*s == '\0') - return NULL; - return (char *) s; -} -#endif - #ifndef __HAVE_ARCH_STRRCHR /** * strrchr - Find the last occurrence of a character in a string --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -14,6 +14,7 @@ lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o +lib-y += strchr.o lib-y += strcmp.o lib-y += strlcat.o lib-y += strlcpy.o --- /dev/null +++ b/xen/lib/strchr.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strchr - Find the first occurrence of a character in a string + * @s: The string to be searched + * @c: The character to search for + */ +char *(strchr)(const char *s, int c) +{ + for(; *s != (char) c; ++s) + if (*s == '\0') + return NULL; + return (char *) s; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:26:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A52C433ED for ; Thu, 1 Apr 2021 10:26:26 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D97A8606A5 for ; Thu, 1 Apr 2021 10:26:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D97A8606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104337.199473 (Exim 4.92) (envelope-from ) id 1lRuWn-0003Gx-An; Thu, 01 Apr 2021 10:26:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104337.199473; Thu, 01 Apr 2021 10:26:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWn-0003Gp-6y; Thu, 01 Apr 2021 10:26:17 +0000 Received: by outflank-mailman (input) for mailman id 104337; Thu, 01 Apr 2021 10:26:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWl-0003GV-JZ for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:15 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8cbf186b-7f8d-4fe7-ba1e-bd29d2d9e1e1; Thu, 01 Apr 2021 10:26:14 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2342DAEA6; Thu, 1 Apr 2021 10:26:14 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8cbf186b-7f8d-4fe7-ba1e-bd29d2d9e1e1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272774; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7CQlp/3jZ9dRZw9Vi/DgDQTsQjZRZ6m3Z3hDPiBuKzw=; b=IAa1jhudL+MvVkyP8zM15xMr+PfcQASoedZ1A6T5vVEAsPmx1hxXIgiJxAucDrI8Yv++mO KjPCT+RKtcPfoP+55OZhFppOEYBoA5IFNRTEnsf4kSjpZ4Flo+QGICfOavJ8BbuQPJwUGr 8q0Jf0PyY7n1Jj9XX3hzXpVzYjrsHqo= Subject: [PATCH 17/23] lib: move strrchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <078a3947-5c1d-c84e-9f57-ad86ea415ec4@suse.com> Date: Thu, 1 Apr 2021 12:26:13 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -56,24 +56,6 @@ int (strcasecmp)(const char *s1, const c } #endif -#ifndef __HAVE_ARCH_STRRCHR -/** - * strrchr - Find the last occurrence of a character in a string - * @s: The string to be searched - * @c: The character to search for - */ -char *(strrchr)(const char *s, int c) -{ - const char *p = s + strlen(s); - - for (; *p != (char)c; --p) - if (p == s) - return NULL; - - return (char *)p; -} -#endif - #ifndef __HAVE_ARCH_STRSPN /** * strspn - Calculate the length of the initial substring of @s which only --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -21,6 +21,7 @@ lib-y += strlcpy.o lib-y += strlen.o lib-y += strncmp.o lib-y += strnlen.o +lib-y += strrchr.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strrchr.c @@ -0,0 +1,31 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strrchr - Find the last occurrence of a character in a string + * @s: The string to be searched + * @c: The character to search for + */ +char *(strrchr)(const char *s, int c) +{ + const char *p = s + strlen(s); + + for (; *p != (char)c; --p) + if (p == s) + return NULL; + + return (char *)p; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:26:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04E0CC433ED for ; Thu, 1 Apr 2021 10:26:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B397B606A5 for ; Thu, 1 Apr 2021 10:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B397B606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104341.199484 (Exim 4.92) (envelope-from ) id 1lRuX8-0003P6-J7; Thu, 01 Apr 2021 10:26:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104341.199484; Thu, 01 Apr 2021 10:26:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuX8-0003Oz-G1; Thu, 01 Apr 2021 10:26:38 +0000 Received: by outflank-mailman (input) for mailman id 104341; Thu, 01 Apr 2021 10:26:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuX6-0003Ob-9q for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:36 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a7d08cfe-1552-42ff-bcc2-153e05ca75a5; Thu, 01 Apr 2021 10:26:35 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7342AEAE; Thu, 1 Apr 2021 10:26:34 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a7d08cfe-1552-42ff-bcc2-153e05ca75a5 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272794; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Z8DfS5OHynFArmQHJ/930SfzIBU1VIyvdrzD+YeXk8=; b=Y0eyErH7fv+/zGHrXkC8sVM7VlNzapc1eFJpkUCvGBbk2xhxC6bGEZpbwoavXDaWa4tSZ8 6mKoZjZWNgY/UJPeSXOpB/iM0CKMoIacWLNSYFKRqcGSL/Wpb1w3gSBKEx4KHw24kUW7Mr k7X1xmXHsbDAGXV4viWVgG3YicHtknI= Subject: [PATCH 18/23] lib: move strstr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <168ae189-b247-af8f-a351-6e4df7e3c19f@suse.com> Date: Thu, 1 Apr 2021 12:26:34 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -131,27 +131,6 @@ char * strsep(char **s, const char *ct) } #endif -#ifndef __HAVE_ARCH_STRSTR -/** - * 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 = strlen(s2); - - if (!l2) - return (char *)s1; - - for (l1 = strlen(s1); l1 >= l2; --l1, ++s1) - if (!memcmp(s1, s2, l2)) - return (char *)s1; - - return NULL; -} -#endif - /* * Local variables: * mode: C --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -22,6 +22,7 @@ lib-y += strlen.o lib-y += strncmp.o lib-y += strnlen.o lib-y += strrchr.o +lib-y += strstr.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strstr.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * 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 = strlen(s2); + + if (!l2) + return (char *)s1; + + for (l1 = strlen(s1); l1 >= l2; --l1, ++s1) + if (!memcmp(s1, s2, l2)) + return (char *)s1; + + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:26:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3D86C433ED for ; Thu, 1 Apr 2021 10:27:06 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 930AD606A5 for ; Thu, 1 Apr 2021 10:27:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 930AD606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104343.199497 (Exim 4.92) (envelope-from ) id 1lRuXS-0003X1-T7; Thu, 01 Apr 2021 10:26:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104343.199497; Thu, 01 Apr 2021 10:26:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXS-0003Wu-PF; Thu, 01 Apr 2021 10:26:58 +0000 Received: by outflank-mailman (input) for mailman id 104343; Thu, 01 Apr 2021 10:26:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXR-0003Wf-Km for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:57 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 811f562e-6d16-4cd2-afd5-0cf9757c47c1; Thu, 01 Apr 2021 10:26:56 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 27128AED7; Thu, 1 Apr 2021 10:26:56 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 811f562e-6d16-4cd2-afd5-0cf9757c47c1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NxQjcpTUPkL0effw4pmC6gwxzyQLMUQ+vwEPhHr3nYI=; b=fLUGBvAiPxFNk7QC/qrTxuN05bRy5jsHomCamd/VgNaoU6RfxsFxtSV/vhg8yfRNX3YXR0 YoTqU/4KtcwEhBJjnASAVDlMlWJAlK7qaR93dn3xh37UDqFKBu9NRRAclWrOVeWwPLwY6u ZkFEPSvk0EVfDHTC88Maw77ashJn/vo= Subject: [PATCH 19/23] lib: move strcasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:26:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -41,21 +41,6 @@ int strnicmp(const char *s1, const char } #endif -#ifndef __HAVE_ARCH_STRCASECMP -int (strcasecmp)(const char *s1, const char *s2) -{ - int c1, c2; - - do - { - c1 = tolower(*s1++); - c2 = tolower(*s2++); - } while ( c1 == c2 && c1 != 0 ); - - return c1 - c2; -} -#endif - #ifndef __HAVE_ARCH_STRSPN /** * strspn - Calculate the length of the initial substring of @s which only --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -14,6 +14,7 @@ lib-y += muldiv64.o lib-y += parse-size.o lib-y += rbtree.o lib-y += sort.o +lib-y += strcasecmp.o lib-y += strchr.o lib-y += strcmp.o lib-y += strlcat.o --- /dev/null +++ b/xen/lib/strcasecmp.c @@ -0,0 +1,29 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include +#include + +int (strcasecmp)(const char *s1, const char *s2) +{ + int c1, c2; + + do + { + c1 = tolower(*s1++); + c2 = tolower(*s2++); + } while ( c1 == c2 && c1 != 0 ); + + return c1 - c2; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:27:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C89FC433ED for ; Thu, 1 Apr 2021 10:27:31 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 04B90606A5 for ; Thu, 1 Apr 2021 10:27:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04B90606A5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104348.199508 (Exim 4.92) (envelope-from ) id 1lRuXq-0003fA-8n; Thu, 01 Apr 2021 10:27:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104348.199508; Thu, 01 Apr 2021 10:27:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXq-0003f3-5d; Thu, 01 Apr 2021 10:27:22 +0000 Received: by outflank-mailman (input) for mailman id 104348; Thu, 01 Apr 2021 10:27:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXo-0003es-OI for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:27:20 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1a81a439-b431-45db-9751-ccc66b09c34a; Thu, 01 Apr 2021 10:27:19 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E6FD4AED7; Thu, 1 Apr 2021 10:27:18 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1a81a439-b431-45db-9751-ccc66b09c34a X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272839; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SjGtm5W7+Y86JR8RySHNQ6b5vRhziaOW7hdEkR5iKDg=; b=Jc31pHl8aesvIsWE6/VcRkjFdPLqtXGbS6KUplq9842osHVXpo22OVq/8laWFTKEJxRqGT TsqCP1bXFaz4fE3GfJODgxgMi/mCMui0kaDFWwUb1qOvnBIaj/AZo5WAyNwNkWUYgYTScm bAMHYSLcWkRl5Ebb4eis+/PhYSFrmW4= Subject: [PATCH 20/23] lib: move/rename strnicmp() to strncasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <1db40fc3-df7d-530e-6288-261dbd200e26@suse.com> Date: Thu, 1 Apr 2021 12:27:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US While moving the implementation, also rename it to match strcasecmp(), allowing the similar use of a compiler builting in this case as well. Signed-off-by: Jan Beulich --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1223,8 +1223,8 @@ static int __init map_range_to_domain(co * They are not MMIO and therefore a domain should not be able to * manage them via the IOMEM interface. */ - if ( strnicmp(dt_node_full_name(dev), "/reserved-memory/", - strlen("/reserved-memory/")) != 0 ) + if ( strncasecmp(dt_node_full_name(dev), "/reserved-memory/", + strlen("/reserved-memory/")) != 0 ) { res = iomem_permit_access(d, paddr_to_pfn(addr), paddr_to_pfn(PAGE_ALIGN(addr + len - 1))); --- a/xen/common/string.c +++ b/xen/common/string.c @@ -8,39 +8,6 @@ #include #include -#ifndef __HAVE_ARCH_STRNICMP -/** - * strnicmp - Case insensitive, length-limited string comparison - * @s1: One string - * @s2: The other string - * @len: the maximum number of characters to compare - */ -int strnicmp(const char *s1, const char *s2, size_t len) -{ - /* Yes, Virginia, it had better be unsigned */ - unsigned char c1, c2; - - c1 = 0; c2 = 0; - if (len) { - do { - c1 = *s1; c2 = *s2; - s1++; s2++; - if (!c1) - break; - if (!c2) - break; - if (c1 == c2) - continue; - c1 = tolower(c1); - c2 = tolower(c2); - if (c1 != c2) - break; - } while (--len); - } - return (int)c1 - (int)c2; -} -#endif - #ifndef __HAVE_ARCH_STRSPN /** * strspn - Calculate the length of the initial substring of @s which only --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -275,14 +275,14 @@ static int get_cpufreq_para(struct xen_s strlcpy(op->u.get_para.scaling_governor, "Unknown", CPUFREQ_NAME_LEN); /* governor specific para */ - if ( !strnicmp(op->u.get_para.scaling_governor, - "userspace", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(op->u.get_para.scaling_governor, + "userspace", CPUFREQ_NAME_LEN) ) { op->u.get_para.u.userspace.scaling_setspeed = policy->cur; } - if ( !strnicmp(op->u.get_para.scaling_governor, - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(op->u.get_para.scaling_governor, + "ondemand", CPUFREQ_NAME_LEN) ) { ret = get_cpufreq_ondemand_para( &op->u.get_para.u.ondemand.sampling_rate_max, @@ -350,8 +350,8 @@ static int set_cpufreq_para(struct xen_s { unsigned int freq =op->u.set_para.ctrl_value; - if ( !strnicmp(policy->governor->name, - "userspace", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "userspace", CPUFREQ_NAME_LEN) ) ret = write_userspace_scaling_setspeed(op->cpuid, freq); else ret = -EINVAL; @@ -363,8 +363,8 @@ static int set_cpufreq_para(struct xen_s { unsigned int sampling_rate = op->u.set_para.ctrl_value; - if ( !strnicmp(policy->governor->name, - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "ondemand", CPUFREQ_NAME_LEN) ) ret = write_ondemand_sampling_rate(sampling_rate); else ret = -EINVAL; @@ -376,8 +376,8 @@ static int set_cpufreq_para(struct xen_s { unsigned int up_threshold = op->u.set_para.ctrl_value; - if ( !strnicmp(policy->governor->name, - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "ondemand", CPUFREQ_NAME_LEN) ) ret = write_ondemand_up_threshold(up_threshold); else ret = -EINVAL; --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -111,7 +111,7 @@ struct cpufreq_governor *__find_governor return NULL; list_for_each_entry(t, &cpufreq_governor_list, governor_list) - if (!strnicmp(governor, t->name, CPUFREQ_NAME_LEN)) + if (!strncasecmp(governor, t->name, CPUFREQ_NAME_LEN)) return t; return NULL; --- a/xen/include/xen/string.h +++ b/xen/include/xen/string.h @@ -16,8 +16,8 @@ size_t strlcpy(char *, const char *, siz size_t strlcat(char *, const char *, size_t); int strcmp(const char *, const char *); int strncmp(const char *, const char *, size_t); -int strnicmp(const char *, const char *, size_t); int strcasecmp(const char *, const char *); +int strncasecmp(const char *, const char *, size_t); char *strchr(const char *, int); char *strrchr(const char *, int); char *strstr(const char *, const char *); @@ -48,6 +48,10 @@ void *memchr_inv(const void *, int, size #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2) #endif +#ifndef __HAVE_ARCH_STRCASECMP +#define strncasecmp(s1, s2, n) __builtin_strncasecmp(s1, s2, n) +#endif + #ifndef __HAVE_ARCH_STRCHR #define strchr(s1, c) __builtin_strchr(s1, c) #endif --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -20,6 +20,7 @@ lib-y += strcmp.o lib-y += strlcat.o lib-y += strlcpy.o lib-y += strlen.o +lib-y += strncasecmp.o lib-y += strncmp.o lib-y += strnlen.o lib-y += strrchr.o --- /dev/null +++ b/xen/lib/strncasecmp.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include +#include + +/** + * strncasecmp - Case insensitive, length-limited string comparison + * @s1: One string + * @s2: The other string + * @len: the maximum number of characters to compare + */ +int (strncasecmp)(const char *s1, const char *s2, size_t len) +{ + /* Yes, Virginia, it had better be unsigned */ + unsigned char c1, c2; + + c1 = 0; c2 = 0; + if (len) { + do { + c1 = *s1; c2 = *s2; + s1++; s2++; + if (!c1) + break; + if (!c2) + break; + if (c1 == c2) + continue; + c1 = tolower(c1); + c2 = tolower(c2); + if (c1 != c2) + break; + } while (--len); + } + return (int)c1 - (int)c2; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:27:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C66A8C433B4 for ; Thu, 1 Apr 2021 10:27:55 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FE57610EA for ; Thu, 1 Apr 2021 10:27:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FE57610EA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104351.199521 (Exim 4.92) (envelope-from ) id 1lRuYF-0003mZ-Hn; Thu, 01 Apr 2021 10:27:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104351.199521; Thu, 01 Apr 2021 10:27:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYF-0003mS-EK; Thu, 01 Apr 2021 10:27:47 +0000 Received: by outflank-mailman (input) for mailman id 104351; Thu, 01 Apr 2021 10:27:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYD-0003m8-SO for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:27:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bd0f8501-bf0b-47ff-b6d4-a846ea0fdb10; Thu, 01 Apr 2021 10:27:45 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4BCDEAED7; Thu, 1 Apr 2021 10:27:44 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bd0f8501-bf0b-47ff-b6d4-a846ea0fdb10 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nM+SAR2VDtnfWZt6Cj4esRpAm2vc6rPFnc2zt/YNybg=; b=iG6kGnwhMHT1Ry4Y660ojHxK6QtEzq9Fc/RoUKRR02U4ZgSxTLIftFVWB6qAaEjjoJ061S 1eANE+OCSlJHbbXROPO2rS9FgoDRb72jy4CLIZL28RhWMM2MYjO8h2bUNWfG1D3ulx9GhV SrnuhvFkygUCWSrEEfPYu1eo5kVbkWc= Subject: [PATCH 21/23] lib: move strspn() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <8d5d06fe-7e8b-6275-caa0-bc14c7dbd21f@suse.com> Date: Thu, 1 Apr 2021 12:27:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US In fact the function is unused at present, and hence will now get omitted from the final binaries. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -8,33 +8,6 @@ #include #include -#ifndef __HAVE_ARCH_STRSPN -/** - * strspn - Calculate the length of the initial substring of @s which only - * contain letters in @accept - * @s: The string to be searched - * @accept: The string to search for - */ -size_t strspn(const char *s, const char *accept) -{ - const char *p; - const char *a; - size_t count = 0; - - for (p = s; *p != '\0'; ++p) { - for (a = accept; *a != '\0'; ++a) { - if (*p == *a) - break; - } - if (*a == '\0') - return count; - ++count; - } - - return count; -} -#endif - #ifndef __HAVE_ARCH_STRPBRK /** * strpbrk - Find the first occurrence of a set of characters --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -24,6 +24,7 @@ lib-y += strncasecmp.o lib-y += strncmp.o lib-y += strnlen.o lib-y += strrchr.o +lib-y += strspn.o lib-y += strstr.o lib-$(CONFIG_X86) += xxhash32.o lib-$(CONFIG_X86) += xxhash64.o --- /dev/null +++ b/xen/lib/strspn.c @@ -0,0 +1,40 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strspn - Calculate the length of the initial substring of @s which only + * contain letters in @accept + * @s: The string to be searched + * @accept: The string to search for + */ +size_t strspn(const char *s, const char *accept) +{ + const char *p; + const char *a; + size_t count = 0; + + for (p = s; *p != '\0'; ++p) { + for (a = accept; *a != '\0'; ++a) { + if (*p == *a) + break; + } + if (*a == '\0') + return count; + ++count; + } + + return count; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:28:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85D69C433B4 for ; Thu, 1 Apr 2021 10:28:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34B0160234 for ; Thu, 1 Apr 2021 10:28:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34B0160234 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104355.199533 (Exim 4.92) (envelope-from ) id 1lRuYf-0003uB-Qe; Thu, 01 Apr 2021 10:28:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104355.199533; Thu, 01 Apr 2021 10:28:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYf-0003u4-N3; Thu, 01 Apr 2021 10:28:13 +0000 Received: by outflank-mailman (input) for mailman id 104355; Thu, 01 Apr 2021 10:28:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYd-0003tJ-KD for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:28:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1478dab0-275f-40ce-b15b-7c79bc5c64d5; Thu, 01 Apr 2021 10:28:06 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2140FAEAE; Thu, 1 Apr 2021 10:28:06 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1478dab0-275f-40ce-b15b-7c79bc5c64d5 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TDElynrA860OZeILtOTuJZZOjvaOuLrkyPrL9SlIZ48=; b=ih/DV0qn6PP0h4TaCI//rSw68v1Ey73GM+SKB8rNMyrkhGldQClNBDWKqERbdB7Vmyq9G1 KHw3dSAn+zrM2oiT/Vmj7HD/WYP7+tbgZowuwOMR1uvw39ZoIN42weLROytxkY1Pwc5Jt4 U8CZ/H72u8RQlA+qtMu9j2q/vO+vKyE= Subject: [PATCH 22/23] lib: move strpbrk() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <8a492d52-7c2b-f926-9ba2-8e57ec0bbc97@suse.com> Date: Thu, 1 Apr 2021 12:28:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -8,26 +8,6 @@ #include #include -#ifndef __HAVE_ARCH_STRPBRK -/** - * strpbrk - Find the first occurrence of a set of characters - * @cs: The string to be searched - * @ct: The characters to search for - */ -char * strpbrk(const char * cs,const char * ct) -{ - const char *sc1,*sc2; - - for( sc1 = cs; *sc1 != '\0'; ++sc1) { - for( sc2 = ct; *sc2 != '\0'; ++sc2) { - if (*sc1 == *sc2) - return (char *) sc1; - } - } - return NULL; -} -#endif - #ifndef __HAVE_ARCH_STRSEP /** * strsep - Split a string into tokens --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -23,6 +23,7 @@ lib-y += strlen.o lib-y += strncasecmp.o lib-y += strncmp.o lib-y += strnlen.o +lib-y += strpbrk.o lib-y += strrchr.o lib-y += strspn.o lib-y += strstr.o --- /dev/null +++ b/xen/lib/strpbrk.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strpbrk - Find the first occurrence of a set of characters + * @cs: The string to be searched + * @ct: The characters to search for + */ +char *strpbrk(const char * cs,const char * ct) +{ + const char *sc1,*sc2; + + for( sc1 = cs; *sc1 != '\0'; ++sc1) { + for( sc2 = ct; *sc2 != '\0'; ++sc2) { + if (*sc1 == *sc2) + return (char *) sc1; + } + } + return NULL; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From patchwork Thu Apr 1 10:28:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12177763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D200C433B4 for ; Thu, 1 Apr 2021 10:28:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 282FD60234 for ; Thu, 1 Apr 2021 10:28:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 282FD60234 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.104357.199545 (Exim 4.92) (envelope-from ) id 1lRuYu-0003zX-2w; Thu, 01 Apr 2021 10:28:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 104357.199545; Thu, 01 Apr 2021 10:28:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYt-0003zP-Vy; Thu, 01 Apr 2021 10:28:27 +0000 Received: by outflank-mailman (input) for mailman id 104357; Thu, 01 Apr 2021 10:28:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYt-0003zD-FY for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:28:27 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d0afee1c-02a0-4d9d-9fb5-3fadceb45989; Thu, 01 Apr 2021 10:28:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EF251AEAE; Thu, 1 Apr 2021 10:28:25 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d0afee1c-02a0-4d9d-9fb5-3fadceb45989 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VvuuIHZDWbgJZbFTLmgAhc0Yr8Pw5QBP9Pn9CAur/LY=; b=ibt83e9cmBXcUUMeBS1l43oM1LDzCCnKqbQOTfC44+CqoRMy3pfwOBKX2++V1GWDfjjoSU 0f/Crb8UOD60/rmt1mdnAl6aai7z3jWlVTyq7sbrbV5q/bTaStnMTION02VMAuVM5zVgww RiDOucE/r7K9rehJxWeAjg/Jgg4T7hg= Subject: [PATCH 23/23] lib: move strsep() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <692a24a5-c7a1-b6cc-b618-a620432a030d@suse.com> Date: Thu, 1 Apr 2021 12:28:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Signed-off-by: Jan Beulich --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -40,7 +40,6 @@ obj-y += softirq.o obj-y += smp.o obj-y += spinlock.o obj-y += stop_machine.o -obj-y += string.o obj-y += symbols.o obj-y += tasklet.o obj-y += time.o --- a/xen/common/string.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * linux/lib/string.c - * - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -#include -#include -#include - -#ifndef __HAVE_ARCH_STRSEP -/** - * strsep - Split a string into tokens - * @s: The string to be searched - * @ct: The characters to search for - * - * strsep() updates @s to point after the token, ready for the next call. - * - * It returns empty tokens, too, behaving exactly like the libc function - * of that name. In fact, it was stolen from glibc2 and de-fancy-fied. - * Same semantics, slimmer shape. ;) - */ -char * strsep(char **s, const char *ct) -{ - char *sbegin = *s, *end; - - if (sbegin == NULL) - return NULL; - - end = strpbrk(sbegin, ct); - if (end) - *end++ = '\0'; - *s = end; - - return sbegin; -} -#endif - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 8 - * tab-width: 8 - * indent-tabs-mode: t - * End: - */ --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -25,6 +25,7 @@ lib-y += strncmp.o lib-y += strnlen.o lib-y += strpbrk.o lib-y += strrchr.o +lib-y += strsep.o lib-y += strspn.o lib-y += strstr.o lib-$(CONFIG_X86) += xxhash32.o --- /dev/null +++ b/xen/lib/strsep.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include + +/** + * strsep - Split a string into tokens + * @s: The string to be searched + * @ct: The characters to search for + * + * strsep() updates @s to point after the token, ready for the next call. + * + * It returns empty tokens, too, behaving exactly like the libc function + * of that name. In fact, it was stolen from glibc2 and de-fancy-fied. + * Same semantics, slimmer shape. ;) + */ +char *strsep(char **s, const char *ct) +{ + char *sbegin = *s, *end; + + if (sbegin == NULL) + return NULL; + + end = strpbrk(sbegin, ct); + if (end) + *end++ = '\0'; + *s = end; + + return sbegin; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */