From patchwork Wed Apr 21 14:18:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216249 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 968E5C433B4 for ; Wed, 21 Apr 2021 14:18:44 +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 37EE66144D for ; Wed, 21 Apr 2021 14:18:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37EE66144D 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.114603.218431 (Exim 4.92) (envelope-from ) id 1lZDga-0000aT-1P; Wed, 21 Apr 2021 14:18:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114603.218431; Wed, 21 Apr 2021 14:18:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgZ-0000aM-US; Wed, 21 Apr 2021 14:18:35 +0000 Received: by outflank-mailman (input) for mailman id 114603; Wed, 21 Apr 2021 14:18:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgZ-0000aE-8R for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:18:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 89c86038-d41f-4c3e-9bb8-30afb418ba75; Wed, 21 Apr 2021 14:18:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id ABC4CB4CD; Wed, 21 Apr 2021 14:18:33 +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: 89c86038-d41f-4c3e-9bb8-30afb418ba75 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=1619014713; 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=/d26MLtHBgPluR/30xU7WDm4VyvrZB+0UEUOK8FBrMQ=; b=PZUXF+9zIQL0NUDj7+a+2L+tpZgCdGe+PoIJaKFlUyLnMzM5LBK5lOd0Y3T+broKMY9ebm 24e0n76jF7fd7jrQMCgNow3OhKDH1NhpISnmjsFQGZdJD/bzm2N3BVb4wAUk+8bV85B4vI yKIV+bjgfFOyD3Pq5PO33yqphVrqSGA= Subject: [PATCH v2 01/20] 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 References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <48444e14-5c38-efc2-b9d8-2802678c0639@suse.com> Date: Wed, 21 Apr 2021 16:18:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> 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. Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:18: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: 12216251 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 0B737C433B4 for ; Wed, 21 Apr 2021 14:19:04 +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 9771E6144B for ; Wed, 21 Apr 2021 14:19:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9771E6144B 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.114605.218442 (Exim 4.92) (envelope-from ) id 1lZDgt-0000hL-9j; Wed, 21 Apr 2021 14:18:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114605.218442; Wed, 21 Apr 2021 14:18: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 1lZDgt-0000hD-6p; Wed, 21 Apr 2021 14:18:55 +0000 Received: by outflank-mailman (input) for mailman id 114605; Wed, 21 Apr 2021 14:18: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 1lZDgs-0000gq-8w for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:18:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fec5f106-5e72-4f63-a3b6-08936010f98d; Wed, 21 Apr 2021 14:18:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7712B4A7; Wed, 21 Apr 2021 14:18:52 +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: fec5f106-5e72-4f63-a3b6-08936010f98d 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=1619014732; 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=FiBwCz4dwAqT37AlnbBbOZ4vWqaWoYHBKFYgRm0agTA=; b=RoT/kousnB94ZwZVfCZHkz6zIqAIF94qOdwqe8b8ZGrMs3mrTOFwd0zBBF6etjPu4LEumS /MAUd8Y8+tTEfvKc17gcJw77ZMCuuFthejAVH5JM13ch92STSiWm6fF38f3dLJJY9cDwsy EeYCzB+7/PkDjRAxmbhBZkkjw/Er8Q4= Subject: [PATCH v2 02/20] 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 References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <0d651bc9-c877-949b-ff04-937f19fa9f89@suse.com> Date: Wed, 21 Apr 2021 16:18:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> 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. Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:19: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: 12216253 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 55590C433B4 for ; Wed, 21 Apr 2021 14:19:38 +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 EA1C26144D for ; Wed, 21 Apr 2021 14:19:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA1C26144D 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.114621.218454 (Exim 4.92) (envelope-from ) id 1lZDhR-0000q3-Ky; Wed, 21 Apr 2021 14:19:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114621.218454; Wed, 21 Apr 2021 14:19:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhR-0000pw-H9; Wed, 21 Apr 2021 14:19:29 +0000 Received: by outflank-mailman (input) for mailman id 114621; Wed, 21 Apr 2021 14:19:28 +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 1lZDhP-0000pn-WC for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:19:28 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d9f37bc2-d12e-4e4e-9f66-14e3e0d0ac09; Wed, 21 Apr 2021 14:19:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1DEF2B4A7; Wed, 21 Apr 2021 14:19:26 +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: d9f37bc2-d12e-4e4e-9f66-14e3e0d0ac09 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=1619014766; 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=4R2Kmdij+h7UMUrUU26n2n0qiNSiY0BDhxk21aCtqCI=; b=bNKJ+PNDRzGe6beV8YHwPrAavJRdDodGVVVAJEOOgCxUJWLIEsypNxa2npUXjO995SYdKs 7jjk/R2u3blnPbtLHfi5/8UTFmUHHlZyKIP6q7aBqGA935G0+o2LNDlUMqSPwdTPZsvVuN uUXANBw9o1HfAKGsmJn6poxD1zaz50g= Subject: [PATCH v2 03/20] 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 References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <2eb9714b-3506-1216-1ce8-35ea000a37da@suse.com> Date: Wed, 21 Apr 2021 16:19:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> 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. Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:19:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216255 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 4C3E4C433ED for ; Wed, 21 Apr 2021 14:19: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 00D696144D for ; Wed, 21 Apr 2021 14:19:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00D696144D 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.114625.218466 (Exim 4.92) (envelope-from ) id 1lZDhh-0000w9-2S; Wed, 21 Apr 2021 14:19:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114625.218466; Wed, 21 Apr 2021 14:19:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhg-0000w2-Ve; Wed, 21 Apr 2021 14:19:44 +0000 Received: by outflank-mailman (input) for mailman id 114625; Wed, 21 Apr 2021 14:19:44 +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 1lZDhg-0000vn-D9 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:19:44 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2243289f-97a6-469f-b304-63de479f3aa3; Wed, 21 Apr 2021 14:19:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C41A4B4A7; Wed, 21 Apr 2021 14:19:42 +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: 2243289f-97a6-469f-b304-63de479f3aa3 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=1619014782; 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=nduKn0BMFGqCtcRpgHoipLRjh1wYJIQ6hbGO3WbSEd0=; b=t4Tz3tvwkS9qeGbkvd3KI3Ps3AD8rgXfGOM+eJVgCvimaTNM43sf9FGmUaC7b0haim8u2b nWVhVVmVHzE0lK1+Kdi3WghSiAvY7XyMLhWJ9HZYFJzPh0nKYNp4rQyF8gwsnbevQdzYW0 xtxlj6CkQPLaQwIx1MHkji/cxHVhD4Q= Subject: [PATCH v2 04/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:19:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:20:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216257 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 1BB53C433B4 for ; Wed, 21 Apr 2021 14:20:13 +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 C385761451 for ; Wed, 21 Apr 2021 14:20:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C385761451 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.114629.218479 (Exim 4.92) (envelope-from ) id 1lZDi0-0001Pu-B4; Wed, 21 Apr 2021 14:20:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114629.218479; Wed, 21 Apr 2021 14:20: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 1lZDi0-0001PN-86; Wed, 21 Apr 2021 14:20:04 +0000 Received: by outflank-mailman (input) for mailman id 114629; Wed, 21 Apr 2021 14:20:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhz-0001IQ-HO for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:20:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8e7d62fd-09e3-4208-ad9c-2218983a4961; Wed, 21 Apr 2021 14:20:02 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 11B76B4D2; Wed, 21 Apr 2021 14:20:02 +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: 8e7d62fd-09e3-4208-ad9c-2218983a4961 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=1619014802; 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=LMbNhxvtMq9ZbvXRz7K3D0FtL1970oZAtxN+hjxjzs4=; b=EUS0ZLZr56tjgYiJxWjYk/08qI0ufPHLI2Pl4Boo14WdDZS3BLanwY/I4CtlBce05GfZsT siFoNCbyUuD7D7y0cS5Rww2VkUWv9CYH009c9soHCW3Htocj3nKk6mKCgV3tvMzdvboc+3 cLxN0APDV1U9MD4XCnndNI/Cpw8EhRo= Subject: [PATCH v2 05/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <50a77bf7-e35b-be24-9cc3-a1691e7c7f90@suse.com> Date: Wed, 21 Apr 2021 16:20:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:20: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: 12216259 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 1ADD5C433ED for ; Wed, 21 Apr 2021 14:20: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 B557761434 for ; Wed, 21 Apr 2021 14:20:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B557761434 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.114634.218490 (Exim 4.92) (envelope-from ) id 1lZDiN-0001qu-JE; Wed, 21 Apr 2021 14:20:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114634.218490; Wed, 21 Apr 2021 14:20: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 1lZDiN-0001qn-GL; Wed, 21 Apr 2021 14:20:27 +0000 Received: by outflank-mailman (input) for mailman id 114634; Wed, 21 Apr 2021 14:20: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 1lZDiL-0001qS-OI for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:20:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d46683da-66f3-4c43-8f60-c9cf69430d10; Wed, 21 Apr 2021 14:20:24 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 166D2B4D0; Wed, 21 Apr 2021 14:20: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: d46683da-66f3-4c43-8f60-c9cf69430d10 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=1619014824; 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=5hNPv/9z1szKdd0KceZZSiWvREDVh3EkEtocexi/+Dc=; b=Id8kVtUTkHiZARNT1JFvqAD2xH1LaSYZwsb0d/lLxkT1oGtjumfNxmJHuzOnxl+5L0B78f bbcfbd/SUajksZHOlFmPc/7NsLQ9SuQNLfOIDNH3gRciz+nUOhnBLbRJLbksInc7CsD47/ +QRwXQwrZWSj2sUhv0+1fk8WVW8aKhU= Subject: [PATCH v2 06/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:20:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:22:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216261 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 1932DC433ED for ; Wed, 21 Apr 2021 14:22: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 AEAA161425 for ; Wed, 21 Apr 2021 14:22:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AEAA161425 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.114647.218515 (Exim 4.92) (envelope-from ) id 1lZDjz-00028Y-7Y; Wed, 21 Apr 2021 14:22:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114647.218515; Wed, 21 Apr 2021 14:22:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDjz-00028R-4e; Wed, 21 Apr 2021 14:22:07 +0000 Received: by outflank-mailman (input) for mailman id 114647; Wed, 21 Apr 2021 14:22:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDjy-00028K-Hw for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:22:06 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f3bb62b6-9a44-4c09-ac87-6e0aec27326b; Wed, 21 Apr 2021 14:22:05 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D6060B4D2; Wed, 21 Apr 2021 14:22:04 +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: f3bb62b6-9a44-4c09-ac87-6e0aec27326b 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=1619014925; 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=E+n1hqpE+sLl3vHGQjm07YiejYA4S+f1I/11X4roUSw=; b=GWdvtYx/UY98X7otMWxLgJo2F/xrKGnUu4cIBfb+GQU6aeAGiH4LY6jt8wW0BzgUNkgHK9 WTApM+F+O1Cr/l/VYTRhc/+iQqeoP8HnD/LdILiXI/lnoy5/A/Z3sAGe/ywLJqX5RR/0q9 aS88jkeo8zJKJjnBlMho1hT6xHzY46k= Subject: [PATCH v2 07/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <96f1217c-d6fb-d83b-741a-2565890ca43c@suse.com> Date: Wed, 21 Apr 2021 16:22:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:22:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216263 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 C9FE6C433B4 for ; Wed, 21 Apr 2021 14:22: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 7C3576144B for ; Wed, 21 Apr 2021 14:22:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C3576144B 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.114654.218526 (Exim 4.92) (envelope-from ) id 1lZDkV-0002G0-HF; Wed, 21 Apr 2021 14:22:39 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114654.218526; Wed, 21 Apr 2021 14:22:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDkV-0002Ft-EN; Wed, 21 Apr 2021 14:22:39 +0000 Received: by outflank-mailman (input) for mailman id 114654; Wed, 21 Apr 2021 14:22:38 +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 1lZDkU-0002Fm-M5 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:22:38 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 28696678-3e3e-4639-8fbc-4d7c7062a3d3; Wed, 21 Apr 2021 14:22:37 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F37E5B4DA; Wed, 21 Apr 2021 14:22:36 +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: 28696678-3e3e-4639-8fbc-4d7c7062a3d3 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=1619014957; 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=Fb5KI+bAQ6MYv9PFZSi0Iz4GZ8NUhpIj7sV5bfwnL9o=; b=eMbeGQRo/x1qjbuNC8P5EH0YE+v/PxmWrDsnwBJ3KMwsZaJbaRnk38zybDlS5m9sxmXDQj 52775amAI3M37xtMtsBFJ6l9YSAA4ZoM2j1hk6+fPEvMxB9wADSsBiB/BdoLiK/5pbimxc /zAF63px+MJtppqvSJwKB6ldq2Mc4K8= Subject: [PATCH v2 08/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <74e09e4a-1a67-b616-8c56-c5dea9184871@suse.com> Date: Wed, 21 Apr 2021 16:22:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:22: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: 12216265 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 A2DBDC433ED for ; Wed, 21 Apr 2021 14:23: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 49BCE6144B for ; Wed, 21 Apr 2021 14:23:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49BCE6144B 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.114660.218539 (Exim 4.92) (envelope-from ) id 1lZDkt-0002NX-UF; Wed, 21 Apr 2021 14:23:03 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114660.218539; Wed, 21 Apr 2021 14:23: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 1lZDkt-0002NQ-R8; Wed, 21 Apr 2021 14:23:03 +0000 Received: by outflank-mailman (input) for mailman id 114660; Wed, 21 Apr 2021 14:23:02 +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 1lZDks-0002MI-Bm for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:02 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4347b79d-625e-44e1-b82a-e6cbfdd24b24; Wed, 21 Apr 2021 14:22:57 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AEB12B4DA; Wed, 21 Apr 2021 14:22: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: 4347b79d-625e-44e1-b82a-e6cbfdd24b24 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=1619014976; 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=s2DVYdfxyAMF+b+0oBREdJVxrIb85Ue9nsEafhsVnbY=; b=rmwtaRcRU2+aEdA3K40YlM7uhrDJfsU3cxMgPTX2WPN5uWwpx/Indj5hEO4GfZZgR8C3R4 VReTu2zhAST3Mk8l/hw4J8tOM3SvCXdtIj4oz5n6itfdRteUC90syytvOnyjQRatrA199p Fi+8RWzlFtzcjXxlkAy+H3j4BZL813I= Subject: [PATCH v2 09/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <6fa3ce3e-30bb-c429-caef-64a66717cb13@suse.com> Date: Wed, 21 Apr 2021 16:22:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:23:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216267 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 C4AA9C433ED for ; Wed, 21 Apr 2021 14:23:27 +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 7B7D661425 for ; Wed, 21 Apr 2021 14:23:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B7D661425 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.114664.218550 (Exim 4.92) (envelope-from ) id 1lZDl9-0002TO-76; Wed, 21 Apr 2021 14:23:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114664.218550; Wed, 21 Apr 2021 14:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDl9-0002TG-41; Wed, 21 Apr 2021 14:23:19 +0000 Received: by outflank-mailman (input) for mailman id 114664; Wed, 21 Apr 2021 14:23:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDl7-0002Sw-BO for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:17 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7999c33c-c299-430d-bc2b-59c0ff8eb038; Wed, 21 Apr 2021 14:23:16 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DA28FB4D3; Wed, 21 Apr 2021 14:23:15 +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: 7999c33c-c299-430d-bc2b-59c0ff8eb038 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=1619014996; 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=4FvIXCowx2UIw7V4q4GB2nIMWZ/2oM6HHFptc5wvIQ8=; b=ay8w0YO2HC27wz0Yo6SJyxWVFYHEuthkRbAM+iqFpR4IwV+diAzeOOV03bvOeDdpWngkLa Cp8JS7FVNgbnjZgPvu4rq5OyVVbFPogJ+byPgvO3aXcW4DE1G24sw0c3dZQJtgZiG8xIOt D3f8Pw00Ai8p8ooizDG3ilHxePf4tj8= Subject: [PATCH v2 10/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:23:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:23:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216269 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 C6151C433B4 for ; Wed, 21 Apr 2021 14:23:50 +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 6161D6144B for ; Wed, 21 Apr 2021 14:23:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6161D6144B 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.114670.218563 (Exim 4.92) (envelope-from ) id 1lZDlW-0002aq-HK; Wed, 21 Apr 2021 14:23:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114670.218563; Wed, 21 Apr 2021 14:23:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlW-0002aj-DK; Wed, 21 Apr 2021 14:23:42 +0000 Received: by outflank-mailman (input) for mailman id 114670; Wed, 21 Apr 2021 14:23:42 +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 1lZDlV-0002ab-U8 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:41 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e1db7945-0e4a-453f-9bd9-22c4fe0f026c; Wed, 21 Apr 2021 14:23:41 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2E0DCB4CD; Wed, 21 Apr 2021 14:23:40 +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: e1db7945-0e4a-453f-9bd9-22c4fe0f026c 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=1619015020; 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=mtUcSlpHHim8EO7pSYWk5WfxwrY5tNdvwHjshpV4nUg=; b=IoZRbRJQcDB5xriNzS4AlksbtOJbraURm986uRG2BAYge0bJtNBXCYR8bSnBNgrA+qtzHA e3YARfvapfUS6rr8I1QY6Do61fpM/39RE2bFcPuHgzKlHSyBKk+v3Z4CBTDcX032OJPyHe 0wGb3HHCObmwxSGeJgVkrCucninRZtg= Subject: [PATCH v2 11/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <0e2d802c-f43a-6028-870b-55ae4234559e@suse.com> Date: Wed, 21 Apr 2021 16:23:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:24: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: 12216271 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 D1078C433ED for ; Wed, 21 Apr 2021 14:24:17 +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 6D20961425 for ; Wed, 21 Apr 2021 14:24:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D20961425 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.114675.218575 (Exim 4.92) (envelope-from ) id 1lZDlw-0002hk-RP; Wed, 21 Apr 2021 14:24:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114675.218575; Wed, 21 Apr 2021 14:24:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlw-0002hd-Mu; Wed, 21 Apr 2021 14:24:08 +0000 Received: by outflank-mailman (input) for mailman id 114675; Wed, 21 Apr 2021 14:24:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlv-0002hS-Ob for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:07 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9d84c05e-1612-47fc-af05-0f30e0f543f0; Wed, 21 Apr 2021 14:24:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 40AD3B4D0; Wed, 21 Apr 2021 14:24: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: 9d84c05e-1612-47fc-af05-0f30e0f543f0 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=1619015046; 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=Qptv3sDhy3glLo/iGAHFmZQ2Uu0levQpMb7ZH5gYAjo=; b=jmordhoN2zOGSVSBlRXfCeIiB4vdFvR6Hr7ADEqqUi2/h/hIE+Nelryqu1kvDpJhUga3fq 909PMMrhIBEw2HNspd45ZcLJn/UKrVS9ZowJVJpz9/Wz9lL2gURCMEYrAAzD/IWR6kk6nx UeJ/8JeeeJUQV7bdfmNnDsJFm5htCLk= Subject: [PATCH v2 12/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:24:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:24:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216273 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 5465DC433B4 for ; Wed, 21 Apr 2021 14:24:38 +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 05E0361434 for ; Wed, 21 Apr 2021 14:24:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05E0361434 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.114677.218587 (Exim 4.92) (envelope-from ) id 1lZDmI-0002oa-3w; Wed, 21 Apr 2021 14:24:30 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114677.218587; Wed, 21 Apr 2021 14:24:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmI-0002oT-0j; Wed, 21 Apr 2021 14:24:30 +0000 Received: by outflank-mailman (input) for mailman id 114677; Wed, 21 Apr 2021 14:24: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 1lZDmG-0002oH-U6 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:28 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id feb0e4c1-2b53-405a-80f1-ccfdac92d2b6; Wed, 21 Apr 2021 14:24:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C15B6B4D5; Wed, 21 Apr 2021 14:24:26 +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: feb0e4c1-2b53-405a-80f1-ccfdac92d2b6 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=1619015066; 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=Ta/mZ1J82vj5/njhIij2ZDZGYO0U9Eh6iVWMMmSf2Hc=; b=mQQW/hnM6g7wVezvow6KwkOfMjTW4xX9c95THs01wF5RLNiaXDOrPp7vwvBhG4noXyLonW +ac+oz9S/nIHSE1CBN8Ury5ALBJLuS/SyQzFGwt3bgosWPHyCbUw/7SzJ8HULTiVGdWZd0 j4kfoCDxfSfeQoDnaV95EMbHT30SlAk= Subject: [PATCH v2 13/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <92e18a3e-bc49-e197-2254-be86c281dbe2@suse.com> Date: Wed, 21 Apr 2021 16:24:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:24:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216275 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 0B429C433B4 for ; Wed, 21 Apr 2021 14:25: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 B26BC61434 for ; Wed, 21 Apr 2021 14:25:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B26BC61434 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.114682.218599 (Exim 4.92) (envelope-from ) id 1lZDme-0002x6-DB; Wed, 21 Apr 2021 14:24:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114682.218599; Wed, 21 Apr 2021 14:24:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDme-0002wy-A1; Wed, 21 Apr 2021 14:24:52 +0000 Received: by outflank-mailman (input) for mailman id 114682; Wed, 21 Apr 2021 14:24:50 +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 1lZDmc-0002wc-Og for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:50 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id dd2df82c-3b11-4ca6-887a-cab46643fff1; Wed, 21 Apr 2021 14:24:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3DAB9AF65; Wed, 21 Apr 2021 14:24:49 +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: dd2df82c-3b11-4ca6-887a-cab46643fff1 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=1619015089; 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=V2D22MGhvbC7x5CodaleCmbDoeONjuiqLIbZE1iqDYk=; b=q76qnLu3ns85impPYj76blrulor0DQ4UeXkLZLLQ/FcON3gec5Oul5km4Usf4yaQKjueHu c0ddaYBQYyG4L1DhD0R14wxZLJaoTz4tct6QcTkSxKfeGVIutbuo4+UxMg2D54EutALDQX tj7djIbMlmxCFFPSdiSgRMKuzSxU+Yg= Subject: [PATCH v2 14/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:24:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:25: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: 12216277 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 6377AC43460 for ; Wed, 21 Apr 2021 14:25:18 +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 078356144B for ; Wed, 21 Apr 2021 14:25:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 078356144B 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.114686.218611 (Exim 4.92) (envelope-from ) id 1lZDmv-00037R-Lc; Wed, 21 Apr 2021 14:25:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114686.218611; Wed, 21 Apr 2021 14:25:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmv-00037J-IS; Wed, 21 Apr 2021 14:25:09 +0000 Received: by outflank-mailman (input) for mailman id 114686; Wed, 21 Apr 2021 14:25:08 +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 1lZDmu-000378-A7 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:08 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8a525680-f73b-4ea2-836a-3110f4070247; Wed, 21 Apr 2021 14:25:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CCAD0B4CD; Wed, 21 Apr 2021 14:25: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: 8a525680-f73b-4ea2-836a-3110f4070247 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=1619015106; 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=8QhvMzXM/i87KvTemiF5H1HaQ7XQjeqnJIEG17bkRhM=; b=pUfnmEZN0+1UKyLaoepXW/lcPsD83VUY7OWw8pkI3d/HBH5tRxqb27rTjwHmGFMEWGoWA8 ghEJ+kQzKpkyGqRv6GdKe8JWHTSDgWWYGEmshycVHVLC4ARpbu0YRSWUmmU8k4dAHKdhLk BX0X3sNdyWsht9zTxQwweYBbir4OG30= Subject: [PATCH v2 15/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <8a44fe36-be00-cfcb-2597-b14b4d4e500c@suse.com> Date: Wed, 21 Apr 2021 16:25:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:25:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216279 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 908A4C433B4 for ; Wed, 21 Apr 2021 14:25:39 +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 3DE1E6144D for ; Wed, 21 Apr 2021 14:25:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DE1E6144D 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.114692.218623 (Exim 4.92) (envelope-from ) id 1lZDnH-0003Gn-2Y; Wed, 21 Apr 2021 14:25:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114692.218623; Wed, 21 Apr 2021 14:25: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 1lZDnG-0003Gg-Vr; Wed, 21 Apr 2021 14:25:30 +0000 Received: by outflank-mailman (input) for mailman id 114692; Wed, 21 Apr 2021 14:25:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnF-0003Ew-JL for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:29 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id acedf932-278d-4352-b1f6-14c048ce1ed4; Wed, 21 Apr 2021 14:25:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 13106B4CD; Wed, 21 Apr 2021 14:25: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: acedf932-278d-4352-b1f6-14c048ce1ed4 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=1619015127; 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=nmQ/c7gIzOZRlLH5fn36bOJsiqI2Th1uZDRwEg8ZZNY=; b=CEEei5MJcJLUjt4oUg8/clwINple8IwJTULy2r+bZYZxZ/GbYtbp9gL5DR4sxCVuc9Emio RqqZCJJt/MSsTtiAecObp7mBC0mAgTsd8CjKh0LWfNxBxC5V3eI5Db178VhlERQHJ/E+KN TOCXAwX0NRpL5ogPr7Evim28A+Z7eog= Subject: [PATCH v2 16/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:25:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:25: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: 12216281 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 9835BC433ED for ; Wed, 21 Apr 2021 14:25: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 51A9E61434 for ; Wed, 21 Apr 2021 14:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51A9E61434 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.114699.218635 (Exim 4.92) (envelope-from ) id 1lZDna-0003PS-C5; Wed, 21 Apr 2021 14:25:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114699.218635; Wed, 21 Apr 2021 14:25: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 1lZDna-0003PL-8N; Wed, 21 Apr 2021 14:25:50 +0000 Received: by outflank-mailman (input) for mailman id 114699; Wed, 21 Apr 2021 14:25: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 1lZDnZ-0003Of-64 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f4cd4473-3831-43fd-a541-b39e8e9c47cb; Wed, 21 Apr 2021 14:25:47 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4F84B4CD; Wed, 21 Apr 2021 14:25: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: f4cd4473-3831-43fd-a541-b39e8e9c47cb 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=1619015147; 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=bOiwld07WhTXpih+DJFsxzfncfqIuvXy8kpeycCOHLA=; b=eAN+ZhDrkq9RX5U6QdCz3DyTvowT4/PQHzOBDHJHwwF6ssGqvM+prkr21rafL9Xv84cHlz A+iHHgoO0nUudLzOGnQjSE0ABfl3dY9fN/RizCQno2HpP5khDtiVrjg50fk61BFLGCep11 kRyhRjSx1dwzfhYFKURRK8P6GxR4T2w= Subject: [PATCH v2 17/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <1fab1400-9bb5-f9e8-0f7f-3213afc0ad92@suse.com> Date: Wed, 21 Apr 2021 16:25:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> 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. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1224,8 +1224,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 Wed Apr 21 14:26: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: 12216283 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 8B99DC433B4 for ; Wed, 21 Apr 2021 14:26:21 +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 377DA61434 for ; Wed, 21 Apr 2021 14:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 377DA61434 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.114706.218647 (Exim 4.92) (envelope-from ) id 1lZDnv-0003ZE-MM; Wed, 21 Apr 2021 14:26:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114706.218647; Wed, 21 Apr 2021 14:26:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnv-0003Z7-H2; Wed, 21 Apr 2021 14:26:11 +0000 Received: by outflank-mailman (input) for mailman id 114706; Wed, 21 Apr 2021 14:26:10 +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 1lZDnu-0003Ys-Cn for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:10 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 888cad03-6053-4b2d-acb0-378bef7832e2; Wed, 21 Apr 2021 14:26:09 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BFD2CB4D3; Wed, 21 Apr 2021 14:26:08 +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: 888cad03-6053-4b2d-acb0-378bef7832e2 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=1619015168; 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=/ikAXGR+d4BQ68yH7iPulr9qDYJtJu1Q/hYMFGUEDmQ=; b=h9YVw9owsJSwRLAOuwbARKv1fN5XXz07GXtO75c3x9FV8uOXtHa/5VNdPPxxFkhPVq+O0A fQCN26olM7rWvOnEjNa1c1B3kYlRgfb4CfylivRzVjGUQxL3papNGHOGXqoYgWT6/r1PZF 7nlyFKtoXqFUtN/K8JZn8Dwm0hl3+0k= Subject: [PATCH v2 18/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <901b2b75-c042-febf-b0cf-a6e7f806b26a@suse.com> Date: Wed, 21 Apr 2021 16:26:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216285 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 91168C433ED for ; Wed, 21 Apr 2021 14:26:41 +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 4BFDE6144D for ; Wed, 21 Apr 2021 14:26:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4BFDE6144D 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.114709.218659 (Exim 4.92) (envelope-from ) id 1lZDoG-0003fh-Ti; Wed, 21 Apr 2021 14:26:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114709.218659; Wed, 21 Apr 2021 14:26:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDoG-0003fY-Q4; Wed, 21 Apr 2021 14:26:32 +0000 Received: by outflank-mailman (input) for mailman id 114709; Wed, 21 Apr 2021 14:26:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDoE-0003f8-Su for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9862c2ce-2e0d-49d5-98b6-64d5735995e4; Wed, 21 Apr 2021 14:26:30 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5DA1DB4D6; Wed, 21 Apr 2021 14:26:29 +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: 9862c2ce-2e0d-49d5-98b6-64d5735995e4 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=1619015189; 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=VRhAA1umJE95thm+BkRB0Qw/wbJzne0Yyf6yVGgrwEI=; b=A9mqYbg1+HuQbbSNgqolaVaq8+sTSP9mtGA92eWE12ebNllVyAlvbyd6JqskUWy0OlnzGu BE5OPXWo6guzO8kqiH3HR+DCR55GphwwC4sBJbPsRtlhgBAMsDBqphUiO4GtIsLoww1dbJ En/MtgON5csJszRQYVQlFLELudHMISc= Subject: [PATCH v2 19/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:26:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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 Wed Apr 21 14:26:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12216287 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 DD139C433B4 for ; Wed, 21 Apr 2021 14:27:05 +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 97D516144D for ; Wed, 21 Apr 2021 14:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97D516144D 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.114715.218671 (Exim 4.92) (envelope-from ) id 1lZDod-0003n9-62; Wed, 21 Apr 2021 14:26:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 114715.218671; Wed, 21 Apr 2021 14:26: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 1lZDod-0003n2-2k; Wed, 21 Apr 2021 14:26:55 +0000 Received: by outflank-mailman (input) for mailman id 114715; Wed, 21 Apr 2021 14:26: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 1lZDoc-0003mo-4P for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4eea3bb6-d7ab-44e6-845c-621b4b4e187c; Wed, 21 Apr 2021 14:26:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 408BDAF65; Wed, 21 Apr 2021 14:26:52 +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: 4eea3bb6-d7ab-44e6-845c-621b4b4e187c 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=1619015212; 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=u2H21liw5DO3IL1nQvzkhzYeKaGhal3AQ8PDJbmUMCo=; b=XqP2dv9mov/1KCzTSo1Vao8a0tPp7NgMQrVDUIvJR5jYig9xHAd2ROdke6ZI9n/T1Tauu2 ZnYLhA4Rf7N6krTfb7dFrXfNLyZOGQZdauKb5YxjH3iSuVMDzFOzjs8G5t4edx15tudKEy QZYEjB4sMA3miMyLa5I7PJgn59OaJwc= Subject: [PATCH v2 20/20] 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: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:26:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Allow the function to be individually linkable, discardable, and overridable. 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: + */