From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272380; cv=none; d=zohomail.com; s=zohoarc; b=DMsKMQggscqxCqIFt1SM0HvdsgHuJkVXevBVJJzwnrrvTpaQzg75VNzOZK5m8rfrKGQNwVtcMzfQPbdeLef8fU0G0M6I9uYcZwaE1tgy4HcEbZAuOH3J8bpmhYVBKFXbRquRPHctNYzhidU3VuAMoqDwRrHoNmMBCfl8ZyX97cc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272380; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9n+mI1T3eTMXqMQfpWtBTAwMJf+lLEmiOgcGI7/pMvs=; b=dy750TDdMY10qSxbXlqSJJ5gjamhTh0gaz81DyGqQr/Dci15Kj7kIYqMTEDxPz0hkZQVZsUGgiqIgsJym/4dPFVE9aE5EiI9ncyuraBQpxrB/H9LrgKVeE/1LDO0RV2Ranb/9wJ7WpG+vk+DGOimN3FAEQAV1Qe159LX4XqtGyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272380718548.4376805896683; Thu, 1 Apr 2021 03:19:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104280.199268 (Exim 4.92) (envelope-from ) id 1lRuQ5-0000cb-12; Thu, 01 Apr 2021 10:19:21 +0000 Received: by outflank-mailman (output) from mailman id 104280.199268; Thu, 01 Apr 2021 10:19:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQ4-0000cU-U2; Thu, 01 Apr 2021 10:19:20 +0000 Received: by outflank-mailman (input) for mailman id 104280; Thu, 01 Apr 2021 10:19:19 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQ3-0000cP-CY for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:19:19 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 18698b2d-322e-4a69-a3c1-ecbb84983cfa; Thu, 01 Apr 2021 10:19:18 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A60E8AED7; Thu, 1 Apr 2021 10:19:17 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 18698b2d-322e-4a69-a3c1-ecbb84983cfa X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272357; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9n+mI1T3eTMXqMQfpWtBTAwMJf+lLEmiOgcGI7/pMvs=; b=VFOQcT58NhjmucUyXOze1BHcqSKPdeJjv3E34UTJrUjtwxeQfDuqavnRIX+nBI4z/KGdQe hriJ50IRFM26dH19iKmqiAfkJQvnV8lW02MQB4ItZMfR/wAXt4eQ2mCRw8gsKACHjnSiQO bSmgHjUlLNKDEbVFv/j+z0liIoNsclg= Subject: [PATCH 01/23] lib: move muldiv64() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:19:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Make this a separate archive member under lib/. While doing so, don't move latently broken x86 assembly though: Fix the constraints, such that properly extending inputs to 64-bit won't just be a side effect of needing to copy registers, and such that we won't fail to clobber %rdx. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monn=C3=A9 --- a/xen/common/lib.c +++ b/xen/common/lib.c @@ -393,35 +393,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 * } #endif /* BITS_PER_LONG =3D=3D 32 */ =20 -/* Compute with 96 bit intermediate result: (a*b)/c */ -uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) -{ -#ifdef CONFIG_X86 - asm ( "mul %%rdx; div %%rcx" : "=3Da" (a) : "0" (a), "d" (b), "c" (c) = ); - return a; -#else - union { - uint64_t ll; - struct { -#ifdef WORDS_BIGENDIAN - uint32_t high, low; -#else - uint32_t low, high; -#endif =20 - } l; - } u, res; - uint64_t rl, rh; - - u.ll =3D a; - rl =3D (uint64_t)u.l.low * (uint64_t)b; - rh =3D (uint64_t)u.l.high * (uint64_t)b; - rh +=3D (rl >> 32); - res.l.high =3D rh / c; - res.l.low =3D (((rh % c) << 32) + (rl & 0xffffffff)) / c; - return res.ll; -#endif -} - /* * Local variables: * mode: C --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o --- /dev/null +++ b/xen/lib/muldiv64.c @@ -0,0 +1,44 @@ +#include + +/* Compute with 96 bit intermediate result: (a*b)/c */ +uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) +{ +#ifdef CONFIG_X86 + asm ( "mulq %1; divq %2" : "+a" (a) + : "rm" ((uint64_t)b), "rm" ((uint64_t)c) + : "rdx" ); + + return a; +#else + union { + uint64_t ll; + struct { +#ifdef WORDS_BIGENDIAN + uint32_t high, low; +#else + uint32_t low, high; +#endif + } l; + } u, res; + uint64_t rl, rh; + + u.ll =3D a; + rl =3D (uint64_t)u.l.low * (uint64_t)b; + rh =3D (uint64_t)u.l.high * (uint64_t)b; + rh +=3D (rl >> 32); + res.l.high =3D rh / c; + res.l.low =3D (((rh % c) << 32) + (rl & 0xffffffff)) / c; + + return res.ll; +#endif +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272407; cv=none; d=zohomail.com; s=zohoarc; b=UZ8ENiOf1vK6eFoe5h6WrurjVRlsrQQo96KOK892EgzJQWuyFHh+P5qLyGbcOMTklSGCZ8UWUi3lNmJpZ6VhDL0QlyGvDiYhWL5NoLrrB4HIVbDNJawtdo6I2DAP+M5mlhNsk73RXR5EfsYiZNsEy+qdEFThSZhC2MvpuaI/7XM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272407; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MQq09dPyj92+Q29K/+2WpJlVyL1zFTQmPSHsHxroQCM=; b=jPq0X08kD9W1aZ0TkltXgZSUurtQamjf/UDSvLZ4xhNZ2ZP491sDWwLu5hzu70fCiddwPE1MOz/OsQLDAHrWOvYRuiHjmpp2H1F3oEgxJi9tkubrAFQgMC2y+zoU2CbyFfmD2FbVjNmrokDnsopc1nbQi6VSBl8VrU2GinfNeog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161727240704996.70302825235012; Thu, 1 Apr 2021 03:20:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104284.199281 (Exim 4.92) (envelope-from ) id 1lRuQY-0000kK-E2; Thu, 01 Apr 2021 10:19:50 +0000 Received: by outflank-mailman (output) from mailman id 104284.199281; Thu, 01 Apr 2021 10:19:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQY-0000kD-AD; Thu, 01 Apr 2021 10:19:50 +0000 Received: by outflank-mailman (input) for mailman id 104284; Thu, 01 Apr 2021 10:19:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuQW-0000k1-GV for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:19:48 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ac7ed814-87d3-4e11-827f-e838f7f435b3; Thu, 01 Apr 2021 10:19:47 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B0B5DAEAE; Thu, 1 Apr 2021 10:19:46 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac7ed814-87d3-4e11-827f-e838f7f435b3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MQq09dPyj92+Q29K/+2WpJlVyL1zFTQmPSHsHxroQCM=; b=asLWaYr+GzD+ctulBCqcr5J1Pe6NlJBNsZZSHGyEMskY7CGokeFC6ereCgztYhN+LJS5L3 iqA17xOzmzD6PcwQkMoN6dtghYvW8jzyEIXEpbYh67YB99mimu85p+6KWTfPEUHTI6Li/s 7EL87fAUJW/u9aIMMBtOnW+gEv4oo4k= Subject: [PATCH 02/23] lib: move 64-bit div/mod compiler helpers From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <0fec827f-bb0b-4ea1-7757-9c27e9138be7@suse.com> Date: Thu, 1 Apr 2021 12:19:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" These were built for 32-bit architectures only (the same code could, with some tweaking, sensibly be used to provide TI-mode helpers on 64-bit arch-es) - retain this property, while still avoiding to have a CU without any contents at all. For this, Arm's CONFIG_64BIT gets generalized. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- xen/arch/Kconfig | 2 ++ xen/arch/arm/Kconfig | 12 +++--------- xen/arch/x86/Kconfig | 1 + xen/common/Makefile | 1 - xen/lib/Makefile | 4 ++++ xen/{common/lib.c =3D> lib/divmod.c} | 2 -- 6 files changed, 10 insertions(+), 12 deletions(-) rename xen/{common/lib.c =3D> lib/divmod.c} (99%) diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig index d144d4c8d3ee..f16eb0df43af 100644 --- a/xen/arch/Kconfig +++ b/xen/arch/Kconfig @@ -1,3 +1,5 @@ +config 64BIT + bool =20 config NR_CPUS int "Maximum number of CPUs" diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 330bbf6232d4..ecfa6822e4d3 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -1,17 +1,11 @@ -config 64BIT - bool - default "$(ARCH)" !=3D "arm32" - help - Say yes to build a 64-bit Xen - Say no to build a 32-bit Xen - config ARM_32 def_bool y - depends on !64BIT + depends on "$(ARCH)" =3D "arm32" =20 config ARM_64 def_bool y - depends on 64BIT + depends on !ARM_32 + select 64BIT select HAS_FAST_MULTIPLY =20 config ARM diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index f79e6634db3f..4d6911ffa467 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -1,5 +1,6 @@ config X86_64 def_bool y + select 64BIT =20 config X86 def_bool y diff --git a/xen/common/Makefile b/xen/common/Makefile index 71c1d466bd8f..e2a7e62d14bf 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -21,7 +21,6 @@ obj-y +=3D kernel.o obj-y +=3D keyhandler.o obj-$(CONFIG_KEXEC) +=3D kexec.o obj-$(CONFIG_KEXEC) +=3D kimage.o -obj-y +=3D lib.o obj-$(CONFIG_LIVEPATCH) +=3D livepatch.o livepatch_elf.o obj-$(CONFIG_MEM_ACCESS) +=3D mem_access.o obj-y +=3D memory.o diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 0b274583ef0b..a5dc1442a422 100644 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -10,3 +10,7 @@ lib-y +=3D rbtree.o lib-y +=3D sort.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o + +lib32-y :=3D divmod.o +lib32-$(CONFIG_64BIT) :=3D +lib-y +=3D $(lib32-y) diff --git a/xen/common/lib.c b/xen/lib/divmod.c similarity index 99% rename from xen/common/lib.c rename to xen/lib/divmod.c index 5b8f49153dad..0be6ccc70096 100644 --- a/xen/common/lib.c +++ b/xen/lib/divmod.c @@ -40,7 +40,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#if BITS_PER_LONG =3D=3D 32 =20 /* * Depending on the desired operation, we view a `long long' (aka quad_t) = in @@ -391,7 +390,6 @@ s64 __ldivmod_helper(s64 a, s64 b, s64 *r) else return quot; } -#endif /* BITS_PER_LONG =3D=3D 32 */ =20 /* * Local variables: From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272437; cv=none; d=zohomail.com; s=zohoarc; b=TXuJq90gdxpAQPr5Gq1PXmlVPcOIwTEeJT4NOlzs1Zryx+vPf9dgBhR14rFlFmAajbQ9zFV2apIwKi3YTHd+jSATO18Q6zzS6m9aQd0Pmnk/uHprWvxDdL658HczCpTwPQmBCWBpSaDKYK41cHeAgIxSFmpQkWW7osRKm0hTcN8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272437; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pPkeQToxrrrMgDYsF5+OEyCjKJhGCfAdjAB1QD105BY=; b=F5C/RQqAetbraR265C6Q9f5ax2J9n/mg/ptid5RlQn/rJ4Je8LnSGcV0bpXmWKT9e5o5lpiWeQYm0IW+iOy6JK/ZXFaX+8ALnKldcFXM7AVEgU/D4iWN6cifvY32pQI4zaXHaOfK8xUlAL/HSiVz8cFMKvwcAZRUXYyp1aGvPys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272437954741.5249987974382; Thu, 1 Apr 2021 03:20:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104288.199293 (Exim 4.92) (envelope-from ) id 1lRuR3-0001Xp-Mf; Thu, 01 Apr 2021 10:20:21 +0000 Received: by outflank-mailman (output) from mailman id 104288.199293; Thu, 01 Apr 2021 10:20:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuR3-0001Xh-Je; Thu, 01 Apr 2021 10:20:21 +0000 Received: by outflank-mailman (input) for mailman id 104288; Thu, 01 Apr 2021 10:20:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuR2-0001Xa-CN for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:20:20 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4a2154c3-18a5-4c48-9603-4d3dc9c13d9b; Thu, 01 Apr 2021 10:20:19 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 811A6AE86; Thu, 1 Apr 2021 10:20:18 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4a2154c3-18a5-4c48-9603-4d3dc9c13d9b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272418; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pPkeQToxrrrMgDYsF5+OEyCjKJhGCfAdjAB1QD105BY=; b=pfFcnH7t3pM/LgBQSszXHdKaTOpO8A45FuPaoYHiidjH6Asav228TrSkkL1WHsKLfaAb7a OtU+tsrVNsMAgMIqSHAhk7SubEazHg82ELaucIDsPkQGfd7ZjSFHUiODCMWpdZz+fWfwg3 rBZzvFL6dFw8K76vw6y1FLMMFB3FuT4= Subject: [PATCH 03/23] string: drop redundant declarations From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:20:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" These standard functions shouldn't need custom declarations. The only case where redundancy might be needed is if there were inline functions there. But we don't have any here (anymore). Prune the per-arch headers of duplicate declarations while moving the asm/string.h inclusion past the declarations. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- a/xen/include/asm-arm/string.h +++ b/xen/include/asm-arm/string.h @@ -8,41 +8,21 @@ */ =20 #define __HAVE_ARCH_STRRCHR -char *strrchr(const char *s, int c); - #define __HAVE_ARCH_STRCHR -char *strchr(const char *s, int c); - #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_STRCMP -int strcmp(const char *, const char *); - #define __HAVE_ARCH_STRNCMP -int strncmp(const char *, const char *, size_t); - #define __HAVE_ARCH_STRLEN -size_t strlen(const char *); - #define __HAVE_ARCH_STRNLEN -size_t strnlen(const char *, size_t); #endif =20 #define __HAVE_ARCH_MEMCPY -void *memcpy(void *, const void *, size_t); - #if defined(CONFIG_ARM_64) #define __HAVE_ARCH_MEMCMP -int memcmp(const void *, const void *, size_t); #endif - #define __HAVE_ARCH_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); - #define __HAVE_ARCH_MEMSET -void *memset(void *, int, size_t); - #define __HAVE_ARCH_MEMCHR -void *memchr(const void *, int, size_t); =20 #if defined(CONFIG_ARM_32) =20 --- a/xen/include/asm-x86/string.h +++ b/xen/include/asm-x86/string.h @@ -2,15 +2,12 @@ #define __X86_STRING_H__ =20 #define __HAVE_ARCH_MEMCPY -void *memcpy(void *dest, const void *src, size_t n); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) =20 #define __HAVE_ARCH_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); #define memmove(d, s, n) __builtin_memmove(d, s, n) =20 #define __HAVE_ARCH_MEMSET -void *memset(void *dest, int c, size_t n); #define memset(s, c, n) __builtin_memset(s, c, n) =20 #endif /* __X86_STRING_H__ */ --- a/xen/include/xen/string.h +++ b/xen/include/xen/string.h @@ -4,11 +4,6 @@ #include /* for size_t */ =20 /* - * Include machine specific inline routines - */ -#include - -/* * These string functions are considered too dangerous for normal use. * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate. */ @@ -17,97 +12,78 @@ #define strncpy __xen_has_no_strncpy__ #define strncat __xen_has_no_strncat__ =20 -#ifndef __HAVE_ARCH_STRLCPY size_t strlcpy(char *, const char *, size_t); -#endif - -#ifndef __HAVE_ARCH_STRLCAT size_t strlcat(char *, const char *, size_t); -#endif +int strcmp(const char *, const char *); +int strncmp(const char *, const char *, size_t); +int strnicmp(const char *, const char *, size_t); +int strcasecmp(const char *, const char *); +char *strchr(const char *, int); +char *strrchr(const char *, int); +char *strstr(const char *, const char *); +size_t strlen(const char *); +size_t strnlen(const char *, size_t); +char *strpbrk(const char *, const char *); +char *strsep(char **, const char *); +size_t strspn(const char *, const char *); + +void *memset(void *, int, size_t); +void *memcpy(void *, const void *, size_t); +void *memmove(void *, const void *, size_t); +int memcmp(const void *, const void *, size_t); +void *memchr(const void *, int, size_t); +void *memchr_inv(const void *, int, size_t); + +#include =20 #ifndef __HAVE_ARCH_STRCMP -int strcmp(const char *, const char *); #define strcmp(s1, s2) __builtin_strcmp(s1, s2) #endif =20 #ifndef __HAVE_ARCH_STRNCMP -int strncmp(const char *, const char *, size_t); #define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n) #endif =20 -#ifndef __HAVE_ARCH_STRNICMP -int strnicmp(const char *, const char *, size_t); -#endif - #ifndef __HAVE_ARCH_STRCASECMP -int strcasecmp(const char *, const char *); #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2) #endif =20 #ifndef __HAVE_ARCH_STRCHR -char *strchr(const char *, int); #define strchr(s1, c) __builtin_strchr(s1, c) #endif =20 #ifndef __HAVE_ARCH_STRRCHR -char *strrchr(const char *, int); #define strrchr(s1, c) __builtin_strrchr(s1, c) #endif =20 #ifndef __HAVE_ARCH_STRSTR -char *strstr(const char *, const char *); #define strstr(s1, s2) __builtin_strstr(s1, s2) #endif =20 #ifndef __HAVE_ARCH_STRLEN -size_t strlen(const char *); #define strlen(s1) __builtin_strlen(s1) #endif =20 -#ifndef __HAVE_ARCH_STRNLEN -size_t strnlen(const char *, size_t); -#endif - -#ifndef __HAVE_ARCH_STRPBRK -char *strpbrk(const char *, const char *); -#endif - -#ifndef __HAVE_ARCH_STRSEP -char *strsep(char **, const char *); -#endif - -#ifndef __HAVE_ARCH_STRSPN -size_t strspn(const char *, const char *); -#endif - - #ifndef __HAVE_ARCH_MEMSET -void *memset(void *, int, size_t); #define memset(s, c, n) __builtin_memset(s, c, n) #endif =20 #ifndef __HAVE_ARCH_MEMCPY -void *memcpy(void *, const void *, size_t); #define memcpy(d, s, n) __builtin_memcpy(d, s, n) #endif =20 #ifndef __HAVE_ARCH_MEMMOVE -void *memmove(void *, const void *, size_t); #define memmove(d, s, n) __builtin_memmove(d, s, n) #endif =20 #ifndef __HAVE_ARCH_MEMCMP -int memcmp(const void *, const void *, size_t); #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n) #endif =20 #ifndef __HAVE_ARCH_MEMCHR -void *memchr(const void *, int, size_t); #define memchr(s, c, n) __builtin_memchr(s, c, n) #endif =20 -void *memchr_inv(const void *, int, size_t); - #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[]) =20 /* safe_xxx always NUL-terminates and returns !=3D0 if result is truncated= . */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272476; cv=none; d=zohomail.com; s=zohoarc; b=Afj+HdZTeb3j6+3oFaeY9wH8G72nOY7tIUk+aOGhr0ulJsadC5lXyphcRNxhHnV/V3H6ky2+jKJy57FptrLYFk+ENACzTXrEhAGeShrnNt5tVvjUUA5Ww1vtc4n+TYn46A/3ELuWF5AbbLC601+VWY8mZrQBaXJzwFPfnNSmElE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272476; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Y/o0dWVTmD5cz4sBu9wV/IeNaEozXqujf7L4dzcBth8=; b=WiHXsDbF//d3r+ZCQEhvIW/K1s6OfssikmQc8CUN0zSJRc4PG7XO+ZxkioM+Jo3LX+n2ivHuuXiYMOSFxMjKFxQ/gyYpHFNP2KM06mUJNUaElH5uoxtIMog8/IAnc1hvlW1qWFWtw2sjnNFBlOPSHZuiYiJUyR3f3/34jDu1BiA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272476468217.48637101538566; Thu, 1 Apr 2021 03:21:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104291.199305 (Exim 4.92) (envelope-from ) id 1lRuRb-0001ec-Vg; Thu, 01 Apr 2021 10:20:55 +0000 Received: by outflank-mailman (output) from mailman id 104291.199305; Thu, 01 Apr 2021 10:20:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuRb-0001eV-So; Thu, 01 Apr 2021 10:20:55 +0000 Received: by outflank-mailman (input) for mailman id 104291; Thu, 01 Apr 2021 10:20:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuRa-0001eO-T3 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:20:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d9035512-b6ab-4b7c-a279-ff6205c89325; Thu, 01 Apr 2021 10:20:54 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2A61DAE86; Thu, 1 Apr 2021 10:20:53 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d9035512-b6ab-4b7c-a279-ff6205c89325 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272453; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y/o0dWVTmD5cz4sBu9wV/IeNaEozXqujf7L4dzcBth8=; b=aK2cPZfJgJb2HHd8yK6Jibspp8y4aisZQvoNWVYGymyoY6ijt9wLNdxwTyIKvZFxtLdv+o QAQaUex2GZ995R2gecrbyNVqqtRv070ZYy3hKGAbZLLDGUvPh2lPDnCSlqPCCFXnDMV7CQ QMxhhTKl3tEQLQYc0kf41ZKztgCB/7g= Subject: [PATCH 04/23] lib: move memset() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:20:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,26 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif =20 -#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 =3D (char *) s; - - while (count--) - *xs++ =3D 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) =20 -#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 +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D memset.o lib-y +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D 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 =3D (char *) s; + + while (count--) + *xs++ =3D c; + + return s; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272496; cv=none; d=zohomail.com; s=zohoarc; b=CZDn23Eg93jDKbAa0MZ8M3B1Ul4YoI5OoK9Pet3AXEUHhVXO7YcsvPPc1/NNIfVAjMA4PFy+BlON7Wl75KFhcFNTOiBqviuVcHlmzaViRuPprWX+HFHrGV9vEOgtxVNt2czd2PBJMxZF1vz2RS/G1bgNrrlao45ZOaE5tjVRwZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oN+5vP1FCboLBZxZsCScrYUIPf9aJGtajya1l3gxAwM=; b=Fjuscldpw9Ii8eYGSGuVJbKWX9nxpezkZCzOfGJ8ZRTlWkB282uyomyQDRwIekJqm5MMqE4bwDodxdVoFxzXNo2AwOQaxNlMp9Uh9SFQ4Kzbpj2sJbJ3ovJoB3sP/ANLhNzsuvtCn22ayJyB4cHYxCD7GfeEWHzkKUWrFL2lzRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272496533859.4873214622372; Thu, 1 Apr 2021 03:21:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104295.199317 (Exim 4.92) (envelope-from ) id 1lRuS2-0001n9-8D; Thu, 01 Apr 2021 10:21:22 +0000 Received: by outflank-mailman (output) from mailman id 104295.199317; Thu, 01 Apr 2021 10:21:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuS2-0001n2-4v; Thu, 01 Apr 2021 10:21:22 +0000 Received: by outflank-mailman (input) for mailman id 104295; Thu, 01 Apr 2021 10:21:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuS1-0001mn-Ch for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:21:21 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4101fc9f-d401-4964-a52b-166a26fb6c06; Thu, 01 Apr 2021 10:21:20 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CDE0CB0B6; Thu, 1 Apr 2021 10:21:19 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4101fc9f-d401-4964-a52b-166a26fb6c06 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272479; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oN+5vP1FCboLBZxZsCScrYUIPf9aJGtajya1l3gxAwM=; b=FvApu/I4xypS6JzaAEaRD3XXPxi2osemKQLvUHQR6rGAud2b9yn/Nk+wJ6oTuoJKlfCBDp wkdLc2NQ1C1INi03PVMetko0NXakIvXDidyMENaJ7iD0BxN62VKLlZLJK7nAmcowcyZD0Q dFA/ionmnepy6LUwJRmF3OcwbJp0VuE= Subject: [PATCH 05/23] lib: move memcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 1 Apr 2021 12:21:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,27 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif =20 -#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 =3D (char *) dest, *s =3D (char *) src; - - while (count--) - *tmp++ =3D *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__ =20 -#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) =20 --- a/xen/lib/Makefile +++ b/xen/lib/Makefile @@ -4,6 +4,7 @@ lib-y +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D memcpy.o lib-y +=3D memset.o lib-y +=3D muldiv64.o lib-y +=3D 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 =3D (char *) dest, *s =3D (char *) src; + + while (count--) + *tmp++ =3D *s++; + + return dest; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272524; cv=none; d=zohomail.com; s=zohoarc; b=icd+9GSAJxQianCv9OxdPJvcf/B5YrYVoHRiKYORfGS7KoOQD8rKmoeUIl79gvk8dJk21jgaRcCGzDwyAffDEvybfEESPaUPR0LX4UZxa8/HM3sm79E1YiCSvyaVvUTlTGgGREMt6VYNnJlCkAv1YYjtF8huqasjuoPlwQ/tvpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272524; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UlwL2DZgk5QMsxjKNY14U9Y4Ed0W95Lps/NjFQlhkyk=; b=Yf9rAqkfU5MbT+2v/G8QeFZhSfFNSwIjf4eYCMAZ+IDEqAtRc5pViBcccmeubomb0sf8JRnD4iPHo8necwgUtL9yuicnaoXdrofdofTMhzTH7J981ultAK0nr0v8+zCSRPPdTaxQlPBEeWTP0kUlhAsyKvZGt23IRyq8G2ZizT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272524385963.4310758868901; Thu, 1 Apr 2021 03:22:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104298.199329 (Exim 4.92) (envelope-from ) id 1lRuSU-0001u2-IN; Thu, 01 Apr 2021 10:21:50 +0000 Received: by outflank-mailman (output) from mailman id 104298.199329; Thu, 01 Apr 2021 10:21:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuSU-0001tv-Eh; Thu, 01 Apr 2021 10:21:50 +0000 Received: by outflank-mailman (input) for mailman id 104298; Thu, 01 Apr 2021 10:21:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuST-0001tl-ED for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:21:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 74a238bc-faa6-4588-a8a9-7155f24fd142; Thu, 01 Apr 2021 10:21:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B82A5AEA6; Thu, 1 Apr 2021 10:21:47 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 74a238bc-faa6-4588-a8a9-7155f24fd142 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272507; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UlwL2DZgk5QMsxjKNY14U9Y4Ed0W95Lps/NjFQlhkyk=; b=kaDKC3HL34Id+gFUhxYyLvm99yhF4rXxMW7FIMhuxPTmBQiRmF3wmZ6EAe/0VgSE1bg0k7 sjlZn/fYs59zGaFD57At7atwibjezKifjFh5+D1MSUMYqwwwNMrJkAm95y3awCiDl9JBV6 rbnSbyOADKk+T2dJVYMBvg5oGLClW34= Subject: [PATCH 06/23] lib: move memmove() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <36449347-69e8-b963-597f-c9359207cf57@suse.com> Date: Thu, 1 Apr 2021 12:21:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" By moving the function into an archive, x86 doesn't need to announce anymore that is has its own implementation - symbol resolution by the linker will now guarantee that the generic function remains unused, and the forwarding to the compiler built-in gets done by the common header anyway. Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -311,36 +311,6 @@ char *(strstr)(const char *s1, const cha } #endif =20 -#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 <=3D src) { - tmp =3D (char *) dest; - s =3D (char *) src; - while (count--) - *tmp++ =3D *s++; - } - else { - tmp =3D (char *) dest + count; - s =3D (char *) src + count; - while (count--) - *--tmp =3D *--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__ =20 -#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 +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D memcpy.o +lib-y +=3D memmove.o lib-y +=3D memset.o lib-y +=3D muldiv64.o lib-y +=3D 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 <=3D src) { + tmp =3D (char *) dest; + s =3D (char *) src; + while (count--) + *tmp++ =3D *s++; + } else { + tmp =3D (char *) dest + count; + s =3D (char *) src + count; + while (count--) + *--tmp =3D *--s; + } + + return dest; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272561; cv=none; d=zohomail.com; s=zohoarc; b=aw3qWSZnWb7icJYXYS/4Ya3DXBwXLSGbkLXu9ut5ZRzVQbeaWc9O2Y0BhOyT74e0kffjRpEmXvK0kmbAaZ/tCSoEiqJMfpZ09eFU+9rLTLN9c7K0RRqCorpTWf487dIB/S09Dv93THsqQdCsD5PM8m5S54xfILM9Hwt6QuGOpow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272561; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=e1kdSAKEAN16LJljjXzIk1aT1zZrsyx9ENiy36Xyzo4=; b=l5Goiq7RZ6pJjvH/nvSutU+AdyYlBnSS+oU1DD0lpSUQADk9Z6s61SITqookE24B3Ix+6cLafb08hW0iPbrk9Xppx+7QGtXLRk+uc7WYpH/cGunI7ECqLDJgmUudrUW+mqUmW6UJ3qYQrtMhxAWE7Nqg6vEGQf3pApHrvy/uCwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272561488788.930881549144; Thu, 1 Apr 2021 03:22:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104301.199341 (Exim 4.92) (envelope-from ) id 1lRuT5-00022C-Qt; Thu, 01 Apr 2021 10:22:27 +0000 Received: by outflank-mailman (output) from mailman id 104301.199341; Thu, 01 Apr 2021 10:22:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuT5-000225-ND; Thu, 01 Apr 2021 10:22:27 +0000 Received: by outflank-mailman (input) for mailman id 104301; Thu, 01 Apr 2021 10:22:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuT3-00021n-UA for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:22:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4fb8832f-be95-4d20-ae58-4b50e73d5c12; Thu, 01 Apr 2021 10:22:25 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7CFFAAEA6; Thu, 1 Apr 2021 10:22:24 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4fb8832f-be95-4d20-ae58-4b50e73d5c12 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272544; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e1kdSAKEAN16LJljjXzIk1aT1zZrsyx9ENiy36Xyzo4=; b=nRlQ+tI8dRA9xfib5Ur7UyMrq1n3GB4VeMrC6gyOVKmf3Zt4PdU4K/t8wvc1PHLd/VBtoS F6J1I3Ut7Ddqt8uy5ZlE1jQxTJ8fm5S4cum06Pnu8hG2N6ISsYnOEbti+Bebgk0uBLbC3e Uc68mOTctRb8XUG6lKVk5Xz1W7OecHI= Subject: [PATCH 07/23] lib: move memcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:22:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D 0; - - for( su1 =3D cs, su2 =3D ct; 0 < count; ++su1, ++su2, count--) - if ((res =3D *su1 - *su2) !=3D 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 +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D memcmp.o lib-y +=3D memcpy.o lib-y +=3D memmove.o lib-y +=3D 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 =3D 0; + + for( su1 =3D cs, su2 =3D ct; 0 < count; ++su1, ++su2, count--) + if ((res =3D *su1 - *su2) !=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272579; cv=none; d=zohomail.com; s=zohoarc; b=PC5KLTrSlYaXtcnpO7D3RX4S+AD2ZnnViBKF/KCTHwf0MX6gkKtjOq7IE2zlWfjfPwTQ3wWVS6jocmXo4dGUmeD1OPaCWKvfAEzoJYLMACM1si6pPd7Ukq1kWBP1XPQa5MWV+S8uCuhphmX/tCuprTitSWddYHL51i3/cwVjCOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272579; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KxBFJAZ2KdhCH/22RG50f65pG/J6rh981un4Qrrk7qs=; b=E4UCWaGNxLi0GNSGz513yBDHkG6UUNAaaSekebkt3iOUJUv5l5SCPjCtPPSOzvFYBx5/GgjGbdIb6Shrtk9lbekXBKkWJHXgiQ0sJya/pfIBwoeEvb6tBWXbL5f1M7jW5/nAQWhAuizG35MUjF3YJfEADrnhkjBazXhYBV0yyDA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272579779405.2375282579068; Thu, 1 Apr 2021 03:22:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104304.199353 (Exim 4.92) (envelope-from ) id 1lRuTO-00028j-72; Thu, 01 Apr 2021 10:22:46 +0000 Received: by outflank-mailman (output) from mailman id 104304.199353; Thu, 01 Apr 2021 10:22:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTO-00028a-3b; Thu, 01 Apr 2021 10:22:46 +0000 Received: by outflank-mailman (input) for mailman id 104304; Thu, 01 Apr 2021 10:22:45 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTN-00028Q-FU for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:22:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1ac8f106-5911-401b-9a4a-e6bb748213bf; Thu, 01 Apr 2021 10:22:44 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C0F65AEA6; Thu, 1 Apr 2021 10:22:43 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1ac8f106-5911-401b-9a4a-e6bb748213bf X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272563; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KxBFJAZ2KdhCH/22RG50f65pG/J6rh981un4Qrrk7qs=; b=uOPVgUllDCy67MY+92BXsz4sL3+4fgw2GNxlRoKLLRqhOEXjpirWugQoKc3gsNO2LlXkmC FBABYsIsKCE0VhREqQFbix1lgQ1FJlnQ9Dt5FUr+do9hQGAZuFY3gpG/fBhtVAh0dMPYHl ReMYzkvJ2zFymUS/MLAa3ZD4XX6NxtE= Subject: [PATCH 08/23] lib: move memchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:22:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D s; - - while (n--) - if ((unsigned char)c =3D=3D *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 +=3D bsearch.o lib-y +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o +lib-y +=3D memchr.o lib-y +=3D memcmp.o lib-y +=3D memcpy.o lib-y +=3D 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 =3D s; + + while (n--) + if ((unsigned char)c =3D=3D *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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272604; cv=none; d=zohomail.com; s=zohoarc; b=Qyd47yay/8nkO9PBmFVkL+/wiAVuNr2TPft9rLWl35ciyEc1VhpHj+yidtxoUnKIZkwAuTU1tEYT6Qi5r+yap4kLqr3kuScLk2FH1cp+SZjgoqda+Msf4GfiXb4iDn3xKwQUgCIDqwmdeD4r7FhcVwPei/Yv+LtmO8vm/ig9Ylc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272604; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5742tdH/lAsOCplYSlX/aqstUJg8Rlv97TdWNCdRmSk=; b=XnAeK4Kf55jz1yFrEG7kFU0CYDM1hkKIzEV2KdbpXdA7tKuCw/OnfCyJMMpT1fPnVfX931+w0vN+hFrCcysXDaPgt5EsghzHtJWbn9SHlxl2Nuqh8GW5dM++jLrqInT746CP3MTv1tEogMGiytaNtQlUFOE8/rIHgJY2q/jheS4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161727260411688.05730406445286; Thu, 1 Apr 2021 03:23:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104309.199365 (Exim 4.92) (envelope-from ) id 1lRuTm-0002Fy-Gj; Thu, 01 Apr 2021 10:23:10 +0000 Received: by outflank-mailman (output) from mailman id 104309.199365; Thu, 01 Apr 2021 10:23:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTm-0002Fr-Dc; Thu, 01 Apr 2021 10:23:10 +0000 Received: by outflank-mailman (input) for mailman id 104309; Thu, 01 Apr 2021 10:23:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuTl-0002Ep-1a for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:09 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5993ffe6-787f-475b-b7ec-368f2c9a3671; Thu, 01 Apr 2021 10:23:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1529BAED7; Thu, 1 Apr 2021 10:23:07 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5993ffe6-787f-475b-b7ec-368f2c9a3671 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272587; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5742tdH/lAsOCplYSlX/aqstUJg8Rlv97TdWNCdRmSk=; b=ANROaimZWyzPlbs+4BeRDilkJtvIDsazHfGxSUcZuaQRhSHX2z0Sjb4Bb/sOszH8YVl/lX PH6jFzbeGidL4IhDn7Gyi6zXcWSZFqKKxFmhYaCw6iNB74mjlsJniiTasoOgEV94SxvN6a 0W8/f1ceznKvCPDD+VZsPlyDN7H/Zbw= Subject: [PATCH 09/23] lib: move memchr_inv() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:23:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -/** - * 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 =3D s; - - while (n--) - if ((unsigned char)c !=3D *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 +=3D ctors.o lib-y +=3D ctype.o lib-y +=3D list-sort.o lib-y +=3D memchr.o +lib-y +=3D memchr_inv.o lib-y +=3D memcmp.o lib-y +=3D memcpy.o lib-y +=3D 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 =3D s; + + while (n--) + if ((unsigned char)c !=3D *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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272625; cv=none; d=zohomail.com; s=zohoarc; b=G4iA0vUH8Y9/INjkr/r7U1R+m/HXcRuAmZnLU4ss12B71IqeC4AeBpm4zXCqc89FRUlORPEQfYCwQgh2LDKeGKDdC2iFJG8eUwsMIY5+mLofauJyU6uSbhdcmGXhrIhpq29GskZ08f5KgaDKFziBKaicLOlivC/jYSW9TosG8XA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272625; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nBbweA3vL9rMSj+WwvAqtgbZp6SBSyR96p37O2EqfpE=; b=Wxgcth4HA82yG8bU950QqmKsykN4cEnbhxpn1HcKnyhUAt7AYIMlJlM8wfQmm8bopNnppVGgxxgDW+mOtisfI/Kz53l+Mxl2mpNGCWbpY1/d9a4mnNxMhI3caAGTlJp4xCI/HOBHfIDGjzK1CHtjGzOqFE1Q4BcqoUTdyRpSqu4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272625011871.6036677935664; Thu, 1 Apr 2021 03:23:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104313.199389 (Exim 4.92) (envelope-from ) id 1lRuU7-0002RT-3d; Thu, 01 Apr 2021 10:23:31 +0000 Received: by outflank-mailman (output) from mailman id 104313.199389; Thu, 01 Apr 2021 10:23:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuU6-0002RM-W1; Thu, 01 Apr 2021 10:23:30 +0000 Received: by outflank-mailman (input) for mailman id 104313; Thu, 01 Apr 2021 10:23:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuU5-0002Qp-2l for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:29 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8f259c5c-d47e-4d74-96f7-75188448331c; Thu, 01 Apr 2021 10:23:28 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A5E6EAE86; Thu, 1 Apr 2021 10:23:27 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8f259c5c-d47e-4d74-96f7-75188448331c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272607; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nBbweA3vL9rMSj+WwvAqtgbZp6SBSyR96p37O2EqfpE=; b=IQTMtGb9knfLlR5xxb9YeGf2M90KdEeJ9v8Ftz46dP/kUuwkZXjOhWzJkGswOBSTUCJpBJ qoLEbyC1jamnFozUKQzTW3yJed1Db/gbrVZZ5GxQNAj0SUeG63ki/MPWA8wZZBH0u96CV8 NDJGkjmZiVUdEszQX1pKTw9IDzrSbKY= Subject: [PATCH 10/23] lib: move strlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <7e82929a-5eb0-a8a2-ec61-005311d74b44@suse.com> Date: Thu, 1 Apr 2021 12:23:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D s; *sc !=3D '\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 +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o +lib-y +=3D strlen.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o =20 --- /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 =3D s; *sc !=3D '\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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272646; cv=none; d=zohomail.com; s=zohoarc; b=lLy7QpUlisIbXddrjBEw5aATbjPFXJbeOSztjYb0WBSnTxBtrhtDOuWOepUOtWmU0d8bR4KXsnZ6lQ3iXen6sBss9Kfg8iGd1LMuNQOCdzH7lhO+rc9+FV8+eyJ+HGF1gHf439xh+Pc4yUCsaWOATP/nspGtFjgMdzBqQnS/eEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272646; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j90++h3cFk0QIuXtJzchPhaTge5uMVq3pz3OcoqtqAs=; b=LKLAJBNGm3tObqf0c/hiDoTkTOBx9GZxfbgeuoSglocDh+Zj+zM7MViDlNweDKfzCaLAbfc5rVCuHJXcHXG2FYm7rEIuVlyFaJACpOA8NePJeAByL3h9RXH1QjBjedKVunXxf/hcWNRx13k9KxVoZ3+/nD5S+JjVXpHnVm9r9fU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161727264673747.369914610114506; Thu, 1 Apr 2021 03:24:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104317.199401 (Exim 4.92) (envelope-from ) id 1lRuUQ-0002YZ-Bq; Thu, 01 Apr 2021 10:23:50 +0000 Received: by outflank-mailman (output) from mailman id 104317.199401; Thu, 01 Apr 2021 10:23:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUQ-0002YR-8V; Thu, 01 Apr 2021 10:23:50 +0000 Received: by outflank-mailman (input) for mailman id 104317; Thu, 01 Apr 2021 10:23:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUP-0002YB-I4 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:23:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 59e2009a-f191-4924-ab52-1b2717c39cc9; Thu, 01 Apr 2021 10:23:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1AD7AAED7; Thu, 1 Apr 2021 10:23:48 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 59e2009a-f191-4924-ab52-1b2717c39cc9 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272628; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j90++h3cFk0QIuXtJzchPhaTge5uMVq3pz3OcoqtqAs=; b=ebPsdQB4HSGKgTai3XRPrGo+eMQXtcbAZIZt9BxS4EYl3absZHxQG6icjnL5RDhQ8fwJji 9yXRzYmkqNx8BXROayS9GwPh9ZtYsedsECPgeRzSaTok0HZogjEl8YTJRU3QfKxNsIH543 2yS9bsH6KoCa2lY3k5pImfBgf90tt4I= Subject: [PATCH 11/23] lib: move strnlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <4545723a-44ec-6586-79bd-7b7f8442619b@suse.com> Date: Thu, 1 Apr 2021 12:23:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D s; count-- && *sc !=3D '\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 +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o lib-y +=3D strlen.o +lib-y +=3D strnlen.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o =20 --- /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 =3D s; count-- && *sc !=3D '\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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272669; cv=none; d=zohomail.com; s=zohoarc; b=lRY3yiOu2Hff2Q0F21tQbKj0dvCrRnY0tdqcDCCWlJlb5gSbiwca1XLEE7HKBT+mSMfi5JeVpofFS5e6a4wFe9fjLFMmtEQyn7kOpqfcw2LOZQ+VCNvyEg3Q0+UVe1zMlIZ7JL/7gKvFs6sDkMfT7gEZsJ2rl+NC1/u7a43e3H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NE7O51HBJ2kdFYFTIPJPJoUwkO79zqoySamP2nD1/Go=; b=leH6lLBvaqx/iDRbduUgUwcunZN6lUqjjpgpQpKluskuxJORY0T5tIhRXovqGy3fJJ+jnvAs7Sw3ZXEMUjYseoTTUOEIXwUTsr9TBCEXTkhKp782sROFogktHvIDb5IyCZnMe/9zO2P1CarD+qpu84Wr5UsNwEMKYmzZbca5h/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272669409984.8544702752413; Thu, 1 Apr 2021 03:24:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104320.199413 (Exim 4.92) (envelope-from ) id 1lRuUm-0002g2-NE; Thu, 01 Apr 2021 10:24:12 +0000 Received: by outflank-mailman (output) from mailman id 104320.199413; Thu, 01 Apr 2021 10:24:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUm-0002fv-J0; Thu, 01 Apr 2021 10:24:12 +0000 Received: by outflank-mailman (input) for mailman id 104320; Thu, 01 Apr 2021 10:24:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuUl-0002fc-07 for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:24:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9ce87208-548f-49a6-90ca-36c4304d5841; Thu, 01 Apr 2021 10:24:10 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 68116AED7; Thu, 1 Apr 2021 10:24:09 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9ce87208-548f-49a6-90ca-36c4304d5841 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NE7O51HBJ2kdFYFTIPJPJoUwkO79zqoySamP2nD1/Go=; b=E84cAT4Yqg1Gf6SKjQef8xh6xzWV+j2HJbYS/kPrH9y6E0819qvAtThuQ6tkhcHT9dv5yn VDu7pyMoUSo9Zy6Qed+wTfOlp7hjnAeA34eKcwKOHJbt9YuivQUy2NEd5CNTWn9CbUm0VK MtkniYyrLZfDRYCigd2gVp4nPIYvjw0= Subject: [PATCH 12/23] lib: move strcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <0b66b9ff-72c0-b645-87a7-13883e046d1f@suse.com> Date: Thu, 1 Apr 2021 12:24:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D *cs - *ct++) !=3D 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 +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o +lib-y +=3D strcmp.o lib-y +=3D strlen.o lib-y +=3D strnlen.o lib-$(CONFIG_X86) +=3D 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 =3D *cs - *ct++) !=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272724; cv=none; d=zohomail.com; s=zohoarc; b=exoSMpNJfG3aYH9pPXXp+ra7iPuxdXvSpalkG1F1vqNTWKh3GWvUvyg8sYHOaL7Uvig7+2KgXso75P7n2TZC8+wbVt/kKaByX5v3TUUeWijCrQzwdb/znbzW5VJyItaQkzezc4hezbWfy8A0rfOqgpWXDeUj/YkzL7QSom9ZDXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272724; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vdu1McyqjuuA+MC/um/kTIQJPhtl9yF8EaqHekvmKgo=; b=QzHBIgZwtbGeVJw/rc+Mx3hwcPY1LzLwK8zD7v7U3uKjEiA1Xd9c+2EKOTgY+rml0OHaT5bTxBDBEROIxi3yc3xDkPJ4YA8OykxtvV9UwujuSBFeax5PIuERqdmaN/3LNjbpHbf2IIsdvUC6YuiS27nwfjnNJqbCRI87NVDuupE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272724473636.8351684181623; Thu, 1 Apr 2021 03:25:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104326.199425 (Exim 4.92) (envelope-from ) id 1lRuVc-0002sP-4b; Thu, 01 Apr 2021 10:25:04 +0000 Received: by outflank-mailman (output) from mailman id 104326.199425; Thu, 01 Apr 2021 10:25:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVc-0002sI-1Q; Thu, 01 Apr 2021 10:25:04 +0000 Received: by outflank-mailman (input) for mailman id 104326; Thu, 01 Apr 2021 10:25:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVa-0002s8-Va for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ce857047-d00c-4769-9c5d-97dcbe6962e9; Thu, 01 Apr 2021 10:25:01 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2B45EAE86; Thu, 1 Apr 2021 10:25:01 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ce857047-d00c-4769-9c5d-97dcbe6962e9 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272701; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vdu1McyqjuuA+MC/um/kTIQJPhtl9yF8EaqHekvmKgo=; b=r6/NqASRM1dJYwp/MXnaampOR5t9AvcCQ/kvOT3tlATyaTFwO99W525Cl83vqSo0mRRjaq BKmsSK3P+FtfMGcv9DvdS4TeC1+6etDbjKx9/X/NngjkOVjohiG1Woy+lqlSadpj4miVuB 7LGHkVDYoSHPBpggcEBLaAYTZ5b/6e4= Subject: [PATCH 13/23] lib: move strncmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D 0; - - while (count) { - if ((__res =3D *cs - *ct++) !=3D 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 +=3D rbtree.o lib-y +=3D sort.o lib-y +=3D strcmp.o lib-y +=3D strlen.o +lib-y +=3D strncmp.o lib-y +=3D strnlen.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D 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 =3D 0; + + while (count) { + if ((__res =3D *cs - *ct++) !=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272741; cv=none; d=zohomail.com; s=zohoarc; b=DkzJJbBVQwCImeGGKm/1updo+K5p2N+wQ9FgtGbWqMgVFYJTB4Jt3fMFvNgBdnnsMNgfvu/KkwyiUvL0Zko5vmyxu6+jCAWyvopelcqZlznMp7ieO7GcM4JpEEW3QFM8OICXhVxnSHOmePS+S7INUeAFo2q65ds/nqiD5sj2XlA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272741; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4XwCcLrzETyMlxHJ7JOlZs5KVV79sUmD+2c2kdGaHMA=; b=f56Yd/6hDHBbKA2vvo9dzhn1SSjuIkt+5TNyS5bCMG7A7cTYpFYSQZMxJ+BQqVwpdi3YttL4Slk3/WpgfOsIltcZqo69DgfORijOyQkKhGk9E7oKCMDyWB99z5/RUiTyKgFwoLO/XJWAJFPBtlBZgDBjJpZPd4xY61lDCfnMrr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272741180997.5425431454971; Thu, 1 Apr 2021 03:25:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104329.199437 (Exim 4.92) (envelope-from ) id 1lRuVz-0002yS-Cf; Thu, 01 Apr 2021 10:25:27 +0000 Received: by outflank-mailman (output) from mailman id 104329.199437; Thu, 01 Apr 2021 10:25:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVz-0002yK-9a; Thu, 01 Apr 2021 10:25:27 +0000 Received: by outflank-mailman (input) for mailman id 104329; Thu, 01 Apr 2021 10:25:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuVx-0002xc-Dv for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 036094cf-81b8-4011-b6db-fe890cd78cbc; Thu, 01 Apr 2021 10:25:20 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D8D0EB032; Thu, 1 Apr 2021 10:25:19 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 036094cf-81b8-4011-b6db-fe890cd78cbc X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272720; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4XwCcLrzETyMlxHJ7JOlZs5KVV79sUmD+2c2kdGaHMA=; b=C2+qIz97TYYRdaJ9CP7uqEwCvbZdml6YmzF5BZWsFZ44auIKOPBkDrUPwA4Yo3E3l0Z1zS yi2W7ZvuhJYTywOlHaCsP8f9vtCkja3IZfjAQgn9gpfHI83sWBkrGslU3hTiuPTO0T8ezt YR/UJJGm5GWHNuW2LQlTWsgVoYkKrLI= Subject: [PATCH 14/23] lib: move strlcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D strlen(src); - - if (size) { - size_t len =3D (ret >=3D size) ? size-1 : ret; - memcpy(dest, src, len); - dest[len] =3D '\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 +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o lib-y +=3D strcmp.o +lib-y +=3D strlcpy.o lib-y +=3D strlen.o lib-y +=3D strncmp.o lib-y +=3D 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 =3D strlen(src); + + if (size) { + size_t len =3D (ret >=3D size) ? size-1 : ret; + memcpy(dest, src, len); + dest[len] =3D '\0'; + } + return ret; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */ From nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272756; cv=none; d=zohomail.com; s=zohoarc; b=mQ3P/ilfPA75FFeEBGMhfIFm2rMmcKnvNpDhAlbpShdq9hum7ttOozaNWBX+W7KHu9yA08Xoq/Y2xg7Yhi4iqNp+fcFIIyMQ9jUfebzMyM5wMjLkPQM23QrlE4N7p8z3+BrSt9tonceCPjOBqdaRDRAFB+FC1eepnvJKabwX8uo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7zV0Im6IiPxLCpobC1iQxqhPYJiA+5gcc1UKfDC95jE=; b=DEMRyDKTIWt1ZzPh6F3NjTEGvrnOqKydvjRBoKCI03CrLo/cqc6EeDc7NDK5M0u+avohpaQz+QRZEoJvZ/1PQH5qfU+oA3PKjIsZ6U7AiZAFfQus5VsMASUpsLVC257Af6Lr9ASuaooYaqerUE+boxrfdyDmn3NBHrf9HVM95TE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161727275632744.00953054776187; Thu, 1 Apr 2021 03:25:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104331.199449 (Exim 4.92) (envelope-from ) id 1lRuWC-00033W-M4; Thu, 01 Apr 2021 10:25:40 +0000 Received: by outflank-mailman (output) from mailman id 104331.199449; Thu, 01 Apr 2021 10:25:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWC-00033O-Ir; Thu, 01 Apr 2021 10:25:40 +0000 Received: by outflank-mailman (input) for mailman id 104331; Thu, 01 Apr 2021 10:25:39 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWB-000337-PI for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:25:39 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 677c0a98-d866-4d9b-8b1c-3e8a1ba29d84; Thu, 01 Apr 2021 10:25:38 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2C59AAE86; Thu, 1 Apr 2021 10:25:38 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 677c0a98-d866-4d9b-8b1c-3e8a1ba29d84 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272738; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7zV0Im6IiPxLCpobC1iQxqhPYJiA+5gcc1UKfDC95jE=; b=qIHew1rsKfuK2G8m4BneQjMHSn9siyKtHP3DEuIQq+5oQ1nJmQe+9C7nowdbf14CV0WPRy etbSo5fCeiotdcA1wIInQqazlEfXO1VD0T9Ry7knf37V9+41Dm7TpLxn7KbayQHofmtlsE p46FEbFxVz1EMvN4NvzMZGJH7SMAMQ4= Subject: [PATCH 15/23] lib: move strlcat() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D strlen(src); - size_t dlen =3D strnlen(dest, size); - char *p =3D dest + dlen; - - while ((p - dest) < size) - if ((*p++ =3D *src++) =3D=3D '\0') - break; - - if (dlen < size) - *(p-1) =3D '\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 +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o lib-y +=3D strcmp.o +lib-y +=3D strlcat.o lib-y +=3D strlcpy.o lib-y +=3D strlen.o lib-y +=3D 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 =3D strlen(src); + size_t dlen =3D strnlen(dest, size); + char *p =3D dest + dlen; + + while ((p - dest) < size) + if ((*p++ =3D *src++) =3D=3D '\0') + break; + + if (dlen < size) + *(p-1) =3D '\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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272777; cv=none; d=zohomail.com; s=zohoarc; b=YWPbVq8OYbsHAx4Gn8ySLZg1GM7dnPzE+kHO7vNWlXVvUrn0UAGG/J6inzTz0Df5kIvPQmcInNQyL5zNpu2o0VWA5KDZ3BmK15UNWWhfgRKamW+oryOZHd6GjjvIyToMOMRRxXv9oISb741Xt6c27u9C79ogitGzucSSPmnccRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272777; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JFsPHBSFCRbpswM140dIBX+K0lYDWe8o/0ZUhNbUxao=; b=Vb7aL+eIRbKq+NQFXbF6XstfUZZe9wUB0Im3xQIsI89eKA2s6k9GmOIj6CLqL+Ca5FutxidsHeignC+81Ernj4KAmvg2NavbxB3YmUgM3XvSL4gXoTW64xlFd+EHgFx+qjyFWoh+vGHcZv109dRLx3IS4nnWjHUQsyDqxIgpswA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272777471973.6762149146084; Thu, 1 Apr 2021 03:26:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104335.199460 (Exim 4.92) (envelope-from ) id 1lRuWa-0003BU-0L; Thu, 01 Apr 2021 10:26:04 +0000 Received: by outflank-mailman (output) from mailman id 104335.199460; Thu, 01 Apr 2021 10:26:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWZ-0003BN-TY; Thu, 01 Apr 2021 10:26:03 +0000 Received: by outflank-mailman (input) for mailman id 104335; Thu, 01 Apr 2021 10:26:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWY-00039I-FF for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:02 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 02ab72af-98ca-4dc6-a62f-7c7dc437c736; Thu, 01 Apr 2021 10:25:58 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 525B3AEA6; Thu, 1 Apr 2021 10:25:57 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 02ab72af-98ca-4dc6-a62f-7c7dc437c736 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272757; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JFsPHBSFCRbpswM140dIBX+K0lYDWe8o/0ZUhNbUxao=; b=sGJ4tbmKIwfb/xiCiCgT6875Pw/IKeNIwYR5si/L2whCsOoKqVFH1PA4xmzr4ohBkZ064U j+3tXw6o3Hyon76EnJ5IIg2TECUlaApHLOhDcMbl+OeKrqdikZDTzZSZfiWgWES9/c4t/T 94hpE5DenHFl9dCJp3cKyAp22WQT8jM= Subject: [PATCH 16/23] lib: move strchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:25:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 !=3D (char) c; ++s) - if (*s =3D=3D '\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 +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o +lib-y +=3D strchr.o lib-y +=3D strcmp.o lib-y +=3D strlcat.o lib-y +=3D 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 !=3D (char) c; ++s) + if (*s =3D=3D '\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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272792; cv=none; d=zohomail.com; s=zohoarc; b=gKjdAGTWGjCmMfjEbmiC2CZKQKrV2R7ec7yydWaga17Ib5fCjr+dB0/qlFoEq5PYNVxbVK5NwV0rms288o0HIOnEQQvL5C9wdKvi2/hMtudIwOA4jYH/VG4S76EGGv1wJpBZm2Y4XJ9tFaRuzfls1mG45Z2xv6P4d/or2AUfXpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272792; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7CQlp/3jZ9dRZw9Vi/DgDQTsQjZRZ6m3Z3hDPiBuKzw=; b=JIfuiXCePYEV9FsCgoD/SVtuY4yctcnLkjd1qScA3qO/WKX8KgoAs4JaGdudxM0QfUh2IlvOUdBQSwYtLNAR5Og7WP1LC7hMW5oXbtI9UD0Cmhd6DNKeJjjq3PhJHAFA6uBo8i3v+Kh2MNgH3FDSkMwyM7QA4Figp7qSWSsybyk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272792422758.154661505267; Thu, 1 Apr 2021 03:26:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104337.199473 (Exim 4.92) (envelope-from ) id 1lRuWn-0003Gx-An; Thu, 01 Apr 2021 10:26:17 +0000 Received: by outflank-mailman (output) from mailman id 104337.199473; Thu, 01 Apr 2021 10:26:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWn-0003Gp-6y; Thu, 01 Apr 2021 10:26:17 +0000 Received: by outflank-mailman (input) for mailman id 104337; Thu, 01 Apr 2021 10:26:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuWl-0003GV-JZ for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:15 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8cbf186b-7f8d-4fe7-ba1e-bd29d2d9e1e1; Thu, 01 Apr 2021 10:26:14 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2342DAEA6; Thu, 1 Apr 2021 10:26:14 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8cbf186b-7f8d-4fe7-ba1e-bd29d2d9e1e1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272774; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7CQlp/3jZ9dRZw9Vi/DgDQTsQjZRZ6m3Z3hDPiBuKzw=; b=IAa1jhudL+MvVkyP8zM15xMr+PfcQASoedZ1A6T5vVEAsPmx1hxXIgiJxAucDrI8Yv++mO KjPCT+RKtcPfoP+55OZhFppOEYBoA5IFNRTEnsf4kSjpZ4Flo+QGICfOavJ8BbuQPJwUGr 8q0Jf0PyY7n1Jj9XX3hzXpVzYjrsHqo= Subject: [PATCH 17/23] lib: move strrchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <078a3947-5c1d-c84e-9f57-ad86ea415ec4@suse.com> Date: Thu, 1 Apr 2021 12:26:13 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D s + strlen(s); - - for (; *p !=3D (char)c; --p) - if (p =3D=3D 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 +=3D strlcpy.o lib-y +=3D strlen.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o +lib-y +=3D strrchr.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o =20 --- /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 =3D s + strlen(s); + + for (; *p !=3D (char)c; --p) + if (p =3D=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272811; cv=none; d=zohomail.com; s=zohoarc; b=nWl8/B6nVENLq85bRdN6VD5BedasY7owGJLcvL3OLJFa3MBzF2+MJLeSPSp9zLAeGU9p+U00dhnxTMft+MypA7S0tDRDjyuY4K3lZv/nWSY3g1m4iPCxZ3AKQCZ1kTfgOXBu2xXNVdSTwHgvdFRIvJACqA2RdcRI1eYR4Fm5oNA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272811; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Z8DfS5OHynFArmQHJ/930SfzIBU1VIyvdrzD+YeXk8=; b=av3PcknROWfuoE5Fcr3wBZgz5o3PplTFlIv2XADIxawbbGGq93jkz1CLxK+4hqTMO3l019DiMBLJoGVdy4yViFtNisPNcD1bKyk6OdZaKLEG4wU4WWMzXHERJsJuFirDHaH3x/0feXP9xsBszv4OY+5aWej3fXkg5rPjLS/vY6w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272811426343.2569649283829; Thu, 1 Apr 2021 03:26:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104341.199484 (Exim 4.92) (envelope-from ) id 1lRuX8-0003P6-J7; Thu, 01 Apr 2021 10:26:38 +0000 Received: by outflank-mailman (output) from mailman id 104341.199484; Thu, 01 Apr 2021 10:26:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuX8-0003Oz-G1; Thu, 01 Apr 2021 10:26:38 +0000 Received: by outflank-mailman (input) for mailman id 104341; Thu, 01 Apr 2021 10:26:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuX6-0003Ob-9q for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:36 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a7d08cfe-1552-42ff-bcc2-153e05ca75a5; Thu, 01 Apr 2021 10:26:35 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7342AEAE; Thu, 1 Apr 2021 10:26:34 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a7d08cfe-1552-42ff-bcc2-153e05ca75a5 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272794; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4Z8DfS5OHynFArmQHJ/930SfzIBU1VIyvdrzD+YeXk8=; b=Y0eyErH7fv+/zGHrXkC8sVM7VlNzapc1eFJpkUCvGBbk2xhxC6bGEZpbwoavXDaWa4tSZ8 6mKoZjZWNgY/UJPeSXOpB/iM0CKMoIacWLNSYFKRqcGSL/Wpb1w3gSBKEx4KHw24kUW7Mr k7X1xmXHsbDAGXV4viWVgG3YicHtknI= Subject: [PATCH 18/23] lib: move strstr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <168ae189-b247-af8f-a351-6e4df7e3c19f@suse.com> Date: Thu, 1 Apr 2021 12:26:34 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D strlen(s2); - - if (!l2) - return (char *)s1; - - for (l1 =3D strlen(s1); l1 >=3D 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 +=3D strlen.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o lib-y +=3D strrchr.o +lib-y +=3D strstr.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D xxhash64.o =20 --- /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 =3D strlen(s2); + + if (!l2) + return (char *)s1; + + for (l1 =3D strlen(s1); l1 >=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272832; cv=none; d=zohomail.com; s=zohoarc; b=WoPB7VDW7F6ssw8qQV7ZqoI6+J4siszVA9UW3OF3aLeF1mSu42r2KTULCXrzeTji5FUlf7jyXbBYUrK1INEjeFrF+twmnmkJDsUAtzSjqSNBvQSqgbs7ZcvT28UXvnxo3b/WVzRgxU27FCjexmhylz2gkdL0VhaK+Ac7EY/aey0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272832; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NxQjcpTUPkL0effw4pmC6gwxzyQLMUQ+vwEPhHr3nYI=; b=msfF7PuYOgu0eECoIlya5yrHdiArj8ZipF6XBRzK9d3wgypNWK9Sgf5WFogbqS9yTm2dTkqGOw6umDzTVP08xlBydCRqWKTzJMJ43P677pl/NJ+SmifoTGVT2swmm2cjqt1xjqTUBySOPOKiroGrp2bL5qqPrSMinYDj2SHpEmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272832890666.8643117994812; Thu, 1 Apr 2021 03:27:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104343.199497 (Exim 4.92) (envelope-from ) id 1lRuXS-0003X1-T7; Thu, 01 Apr 2021 10:26:58 +0000 Received: by outflank-mailman (output) from mailman id 104343.199497; Thu, 01 Apr 2021 10:26:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXS-0003Wu-PF; Thu, 01 Apr 2021 10:26:58 +0000 Received: by outflank-mailman (input) for mailman id 104343; Thu, 01 Apr 2021 10:26:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXR-0003Wf-Km for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:26:57 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 811f562e-6d16-4cd2-afd5-0cf9757c47c1; Thu, 01 Apr 2021 10:26:56 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 27128AED7; Thu, 1 Apr 2021 10:26:56 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 811f562e-6d16-4cd2-afd5-0cf9757c47c1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NxQjcpTUPkL0effw4pmC6gwxzyQLMUQ+vwEPhHr3nYI=; b=fLUGBvAiPxFNk7QC/qrTxuN05bRy5jsHomCamd/VgNaoU6RfxsFxtSV/vhg8yfRNX3YXR0 YoTqU/4KtcwEhBJjnASAVDlMlWJAlK7qaR93dn3xh37UDqFKBu9NRRAclWrOVeWwPLwY6u ZkFEPSvk0EVfDHTC88Maw77ashJn/vo= Subject: [PATCH 19/23] lib: move strcasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: Date: Thu, 1 Apr 2021 12:26:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#ifndef __HAVE_ARCH_STRCASECMP -int (strcasecmp)(const char *s1, const char *s2) -{ - int c1, c2; - - do - { - c1 =3D tolower(*s1++); - c2 =3D tolower(*s2++); - } while ( c1 =3D=3D c2 && c1 !=3D 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 +=3D muldiv64.o lib-y +=3D parse-size.o lib-y +=3D rbtree.o lib-y +=3D sort.o +lib-y +=3D strcasecmp.o lib-y +=3D strchr.o lib-y +=3D strcmp.o lib-y +=3D 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 =3D tolower(*s1++); + c2 =3D tolower(*s2++); + } while ( c1 =3D=3D c2 && c1 !=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272856; cv=none; d=zohomail.com; s=zohoarc; b=JBAV6TjrouvARVacZENNJzED/WFKCWIwaHCmk4rQcC3hBH4UJbpJbNTHIGidz4eXS3EUcnBFLtLnRG9bGxJzLZoqo8VdlmkRLynjgyoPo8TddrWu2ThKQKxxjrH900BH3/HsweWWVmQ3Q4o51lTY/ktYR5YVFBK8xH5Z+hvjcuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272856; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SjGtm5W7+Y86JR8RySHNQ6b5vRhziaOW7hdEkR5iKDg=; b=iSdJ9aVQ3wDzxbkqSueRCQUfR7qOqekq/WuZ2foYPqciN7Wpq7eAn/wrtOKwMxDyDKqzyEbOVVJl0zIViJNu+gW/qLP+qP0Gw5nlhRKDUn82Jem3QRmvp5E7UEYBuJiJTOpxj/atky9Evsg/hKZhrFtw4pheyvIiO8Qa8kBJhfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272856161968.4649640967264; Thu, 1 Apr 2021 03:27:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104348.199508 (Exim 4.92) (envelope-from ) id 1lRuXq-0003fA-8n; Thu, 01 Apr 2021 10:27:22 +0000 Received: by outflank-mailman (output) from mailman id 104348.199508; Thu, 01 Apr 2021 10:27:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXq-0003f3-5d; Thu, 01 Apr 2021 10:27:22 +0000 Received: by outflank-mailman (input) for mailman id 104348; Thu, 01 Apr 2021 10:27:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuXo-0003es-OI for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:27:20 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1a81a439-b431-45db-9751-ccc66b09c34a; Thu, 01 Apr 2021 10:27:19 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E6FD4AED7; Thu, 1 Apr 2021 10:27:18 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1a81a439-b431-45db-9751-ccc66b09c34a X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272839; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SjGtm5W7+Y86JR8RySHNQ6b5vRhziaOW7hdEkR5iKDg=; b=Jc31pHl8aesvIsWE6/VcRkjFdPLqtXGbS6KUplq9842osHVXpo22OVq/8laWFTKEJxRqGT TsqCP1bXFaz4fE3GfJODgxgMi/mCMui0kaDFWwUb1qOvnBIaj/AZo5WAyNwNkWUYgYTScm bAMHYSLcWkRl5Ebb4eis+/PhYSFrmW4= Subject: [PATCH 20/23] lib: move/rename strnicmp() to strncasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <1db40fc3-df7d-530e-6288-261dbd200e26@suse.com> Date: Thu, 1 Apr 2021 12:27:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" While moving the implementation, also rename it to match strcasecmp(), allowing the similar use of a compiler builting in this case as well. Signed-off-by: Jan Beulich --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1223,8 +1223,8 @@ static int __init map_range_to_domain(co * They are not MMIO and therefore a domain should not be able to * manage them via the IOMEM interface. */ - if ( strnicmp(dt_node_full_name(dev), "/reserved-memory/", - strlen("/reserved-memory/")) !=3D 0 ) + if ( strncasecmp(dt_node_full_name(dev), "/reserved-memory/", + strlen("/reserved-memory/")) !=3D 0 ) { res =3D 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 =20 -#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 =3D 0; c2 =3D 0; - if (len) { - do { - c1 =3D *s1; c2 =3D *s2; - s1++; s2++; - if (!c1) - break; - if (!c2) - break; - if (c1 =3D=3D c2) - continue; - c1 =3D tolower(c1); - c2 =3D tolower(c2); - if (c1 !=3D 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_L= EN); =20 /* governor specific para */ - if ( !strnicmp(op->u.get_para.scaling_governor,=20 - "userspace", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(op->u.get_para.scaling_governor, + "userspace", CPUFREQ_NAME_LEN) ) { op->u.get_para.u.userspace.scaling_setspeed =3D policy->cur; } =20 - if ( !strnicmp(op->u.get_para.scaling_governor,=20 - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(op->u.get_para.scaling_governor, + "ondemand", CPUFREQ_NAME_LEN) ) { ret =3D 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 =3Dop->u.set_para.ctrl_value; =20 - if ( !strnicmp(policy->governor->name, - "userspace", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "userspace", CPUFREQ_NAME_LEN) ) ret =3D write_userspace_scaling_setspeed(op->cpuid, freq); else ret =3D -EINVAL; @@ -363,8 +363,8 @@ static int set_cpufreq_para(struct xen_s { unsigned int sampling_rate =3D op->u.set_para.ctrl_value; =20 - if ( !strnicmp(policy->governor->name, - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "ondemand", CPUFREQ_NAME_LEN) ) ret =3D write_ondemand_sampling_rate(sampling_rate); else ret =3D -EINVAL; @@ -376,8 +376,8 @@ static int set_cpufreq_para(struct xen_s { unsigned int up_threshold =3D op->u.set_para.ctrl_value; =20 - if ( !strnicmp(policy->governor->name, - "ondemand", CPUFREQ_NAME_LEN) ) + if ( !strncasecmp(policy->governor->name, + "ondemand", CPUFREQ_NAME_LEN) ) ret =3D write_ondemand_up_threshold(up_threshold); else ret =3D -EINVAL; --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -111,7 +111,7 @@ struct cpufreq_governor *__find_governor return NULL; =20 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; =20 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 =20 +#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 +=3D strcmp.o lib-y +=3D strlcat.o lib-y +=3D strlcpy.o lib-y +=3D strlen.o +lib-y +=3D strncasecmp.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o lib-y +=3D 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 =3D 0; c2 =3D 0; + if (len) { + do { + c1 =3D *s1; c2 =3D *s2; + s1++; s2++; + if (!c1) + break; + if (!c2) + break; + if (c1 =3D=3D c2) + continue; + c1 =3D tolower(c1); + c2 =3D tolower(c2); + if (c1 !=3D 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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272881; cv=none; d=zohomail.com; s=zohoarc; b=SBcQ2HFAqEJUZT637WpuHqpLFZoqQBjGhhp2+ixVu8KaaOtqpm0fQJbnw8ixy4mWJbkaifX1cshEzONK8vDwE8zyvNfkzb+6C/uvaUAUME5DtmCbmAaFl49TYPFV2NXhc3/B1376Mje6PARH+AU4dk3Q7WAnn/haT4gXyb9Gk+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272881; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nM+SAR2VDtnfWZt6Cj4esRpAm2vc6rPFnc2zt/YNybg=; b=l4E3qPcKyZywqNgx9eqY5cZJoxMSJblPG5MD4LvlsYRDbw7x2vSoGCy2eEBufL9kg4gW3zKuOJswGeLQztJPSOJXrxZEUkmAiDDIpFFYvIFMU2Euqrw60wSB7noY3FL+rjxjri1n9GhduKh+Q/AQNxCY0yDxhrq57zBka3eGwIM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16172728816621012.2118440495981; Thu, 1 Apr 2021 03:28:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104351.199521 (Exim 4.92) (envelope-from ) id 1lRuYF-0003mZ-Hn; Thu, 01 Apr 2021 10:27:47 +0000 Received: by outflank-mailman (output) from mailman id 104351.199521; Thu, 01 Apr 2021 10:27:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYF-0003mS-EK; Thu, 01 Apr 2021 10:27:47 +0000 Received: by outflank-mailman (input) for mailman id 104351; Thu, 01 Apr 2021 10:27:45 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYD-0003m8-SO for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:27:45 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bd0f8501-bf0b-47ff-b6d4-a846ea0fdb10; Thu, 01 Apr 2021 10:27:45 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4BCDEAED7; Thu, 1 Apr 2021 10:27:44 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bd0f8501-bf0b-47ff-b6d4-a846ea0fdb10 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nM+SAR2VDtnfWZt6Cj4esRpAm2vc6rPFnc2zt/YNybg=; b=iG6kGnwhMHT1Ry4Y660ojHxK6QtEzq9Fc/RoUKRR02U4ZgSxTLIftFVWB6qAaEjjoJ061S 1eANE+OCSlJHbbXROPO2rS9FgoDRb72jy4CLIZL28RhWMM2MYjO8h2bUNWfG1D3ulx9GhV SrnuhvFkygUCWSrEEfPYu1eo5kVbkWc= Subject: [PATCH 21/23] lib: move strspn() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <8d5d06fe-7e8b-6275-caa0-bc14c7dbd21f@suse.com> Date: Thu, 1 Apr 2021 12:27:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =3D 0; - - for (p =3D s; *p !=3D '\0'; ++p) { - for (a =3D accept; *a !=3D '\0'; ++a) { - if (*p =3D=3D *a) - break; - } - if (*a =3D=3D '\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 +=3D strncasecmp.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o lib-y +=3D strrchr.o +lib-y +=3D strspn.o lib-y +=3D strstr.o lib-$(CONFIG_X86) +=3D xxhash32.o lib-$(CONFIG_X86) +=3D 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 =3D 0; + + for (p =3D s; *p !=3D '\0'; ++p) { + for (a =3D accept; *a !=3D '\0'; ++a) { + if (*p =3D=3D *a) + break; + } + if (*a =3D=3D '\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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272908; cv=none; d=zohomail.com; s=zohoarc; b=AS2awTZM1+KMr9OkYKssvFtYgxBgTx7b+3bcCV2Q44N4eeWzX+CJHPsPhOUgyjD7CsBMS07XT/IuRUh7NsDktTlHW/1FWaTKLCMeUFTN4t5ok8J0zyTTLrW3iQMieCWcCijU74D6lq/9higbT4RiBNoajZMaYMTlOmllL9MZKUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TDElynrA860OZeILtOTuJZZOjvaOuLrkyPrL9SlIZ48=; b=WihJt1br1/62cAV3eBSppSN7M7pyneMaoJIZnkOD3LUEiq9bqtYHZAedRoRd3bl4DkHmZn/ur34hn8kShm0uiU6IYhyND7s2JDlHsYhidDpeQixKRdxXuX8GxrXP3N5SvwpAJSILuIbnYF/Afb8QziEDhbdOUQ2bclrJCPoHk/w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272908132961.2329765755201; Thu, 1 Apr 2021 03:28:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104355.199533 (Exim 4.92) (envelope-from ) id 1lRuYf-0003uB-Qe; Thu, 01 Apr 2021 10:28:13 +0000 Received: by outflank-mailman (output) from mailman id 104355.199533; Thu, 01 Apr 2021 10:28:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYf-0003u4-N3; Thu, 01 Apr 2021 10:28:13 +0000 Received: by outflank-mailman (input) for mailman id 104355; Thu, 01 Apr 2021 10:28:11 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYd-0003tJ-KD for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:28:11 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1478dab0-275f-40ce-b15b-7c79bc5c64d5; Thu, 01 Apr 2021 10:28:06 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2140FAEAE; Thu, 1 Apr 2021 10:28:06 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1478dab0-275f-40ce-b15b-7c79bc5c64d5 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272886; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TDElynrA860OZeILtOTuJZZOjvaOuLrkyPrL9SlIZ48=; b=ih/DV0qn6PP0h4TaCI//rSw68v1Ey73GM+SKB8rNMyrkhGldQClNBDWKqERbdB7Vmyq9G1 KHw3dSAn+zrM2oiT/Vmj7HD/WYP7+tbgZowuwOMR1uvw39ZoIN42weLROytxkY1Pwc5Jt4 U8CZ/H72u8RQlA+qtMu9j2q/vO+vKyE= Subject: [PATCH 22/23] lib: move strpbrk() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <8a492d52-7c2b-f926-9ba2-8e57ec0bbc97@suse.com> Date: Thu, 1 Apr 2021 12:28:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jan Beulich --- a/xen/common/string.c +++ b/xen/common/string.c @@ -8,26 +8,6 @@ #include #include =20 -#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 =3D cs; *sc1 !=3D '\0'; ++sc1) { - for( sc2 =3D ct; *sc2 !=3D '\0'; ++sc2) { - if (*sc1 =3D=3D *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 +=3D strlen.o lib-y +=3D strncasecmp.o lib-y +=3D strncmp.o lib-y +=3D strnlen.o +lib-y +=3D strpbrk.o lib-y +=3D strrchr.o lib-y +=3D strspn.o lib-y +=3D 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 =3D cs; *sc1 !=3D '\0'; ++sc1) { + for( sc2 =3D ct; *sc2 !=3D '\0'; ++sc2) { + if (*sc1 =3D=3D *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 nobody Thu Apr 18 17:06:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617272922; cv=none; d=zohomail.com; s=zohoarc; b=Kz/eVpTUpNoN5pT+ALyKiaHyLfFlAVXHRIWoiEr0IFBY4PV8uia5Kh7ipz5k1+Sbsmo3ygqfiJpb4heHvZLoMyHs8+gIXnalqjh6VSctmmRhd72sbNvJpkiPRGTUBIeDhK8j4n6nqOM+9qcuCGRq0jaeSYVvHNKw5ZslB2mde2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617272922; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VvuuIHZDWbgJZbFTLmgAhc0Yr8Pw5QBP9Pn9CAur/LY=; b=b/sp2xeBHcKpUI1UTZ7ax034piyUwLo9WtDp4AFGYmElS+jBYBxTOeooJG7jaKHs83KGOjz4n8WMlFl9zOFIO+nCSGMrEs/Y7XTz02vgE0p+rP0iiRZNUS2CD7YBLHGy21XTt89WSsjg/8VCxVGkfyGmdlT0xxiPLZCygeDK0ow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617272922105777.314847472237; Thu, 1 Apr 2021 03:28:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.104357.199545 (Exim 4.92) (envelope-from ) id 1lRuYu-0003zX-2w; Thu, 01 Apr 2021 10:28:28 +0000 Received: by outflank-mailman (output) from mailman id 104357.199545; Thu, 01 Apr 2021 10:28:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYt-0003zP-Vy; Thu, 01 Apr 2021 10:28:27 +0000 Received: by outflank-mailman (input) for mailman id 104357; Thu, 01 Apr 2021 10:28:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lRuYt-0003zD-FY for xen-devel@lists.xenproject.org; Thu, 01 Apr 2021 10:28:27 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d0afee1c-02a0-4d9d-9fb5-3fadceb45989; Thu, 01 Apr 2021 10:28:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EF251AEAE; Thu, 1 Apr 2021 10:28:25 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d0afee1c-02a0-4d9d-9fb5-3fadceb45989 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617272906; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VvuuIHZDWbgJZbFTLmgAhc0Yr8Pw5QBP9Pn9CAur/LY=; b=ibt83e9cmBXcUUMeBS1l43oM1LDzCCnKqbQOTfC44+CqoRMy3pfwOBKX2++V1GWDfjjoSU 0f/Crb8UOD60/rmt1mdnAl6aai7z3jWlVTyq7sbrbV5q/bTaStnMTION02VMAuVM5zVgww RiDOucE/r7K9rehJxWeAjg/Jgg4T7hg= Subject: [PATCH 23/23] lib: move strsep() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: Message-ID: <692a24a5-c7a1-b6cc-b618-a620432a030d@suse.com> Date: Thu, 1 Apr 2021 12:28:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Jan Beulich --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -40,7 +40,6 @@ obj-y +=3D softirq.o obj-y +=3D smp.o obj-y +=3D spinlock.o obj-y +=3D stop_machine.o -obj-y +=3D string.o obj-y +=3D symbols.o obj-y +=3D tasklet.o obj-y +=3D 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 =3D *s, *end; - - if (sbegin =3D=3D NULL) - return NULL; - - end =3D strpbrk(sbegin, ct); - if (end) - *end++ =3D '\0'; - *s =3D 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 +=3D strncmp.o lib-y +=3D strnlen.o lib-y +=3D strpbrk.o lib-y +=3D strrchr.o +lib-y +=3D strsep.o lib-y +=3D strspn.o lib-y +=3D strstr.o lib-$(CONFIG_X86) +=3D 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 =3D *s, *end; + + if (sbegin =3D=3D NULL) + return NULL; + + end =3D strpbrk(sbegin, ct); + if (end) + *end++ =3D '\0'; + *s =3D end; + + return sbegin; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + */