From nobody Mon May 6 19:05:38 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=1619014732; cv=none; d=zohomail.com; s=zohoarc; b=Gr+ecPD7Jz3b/M6sN0URK/AbUoIDKpzdVy3dg8yN8kbKjQcqVHCL7R61qlxks/Ke3wSlDyQs5xFBSGp3WaSz/PCZ0ABqb/j62fG3IPm1NhPzIBmGNURZnJ7HeWYkziWGyiySznFfJtXsr75q+pCj23UfNE3a8VCq7VJ/gaYy6ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014732; 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=/d26MLtHBgPluR/30xU7WDm4VyvrZB+0UEUOK8FBrMQ=; b=lY8L5cT1Gegx11OBRsLbwUL76F0H1brBn/ViFV1hTpTQwCoad6VdRR6evtmGwCly1bKUmXd8V/p2eJRK82QTHZJhcAddPdcE6EK1F8ROtwdbiAd7aFrKQwDAua+6v6wBenRxpTcVkII+Bpgfb4STiGzZzLEXH+mJzztMr9B5F/U= 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 1619014732599157.21373181006402; Wed, 21 Apr 2021 07:18:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114603.218431 (Exim 4.92) (envelope-from ) id 1lZDga-0000aT-1P; Wed, 21 Apr 2021 14:18:36 +0000 Received: by outflank-mailman (output) from mailman id 114603.218431; Wed, 21 Apr 2021 14:18:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgZ-0000aM-US; Wed, 21 Apr 2021 14:18:35 +0000 Received: by outflank-mailman (input) for mailman id 114603; Wed, 21 Apr 2021 14:18:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgZ-0000aE-8R for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:18:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 89c86038-d41f-4c3e-9bb8-30afb418ba75; Wed, 21 Apr 2021 14:18:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id ABC4CB4CD; Wed, 21 Apr 2021 14:18:33 +0000 (UTC) X-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: 89c86038-d41f-4c3e-9bb8-30afb418ba75 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014713; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/d26MLtHBgPluR/30xU7WDm4VyvrZB+0UEUOK8FBrMQ=; b=PZUXF+9zIQL0NUDj7+a+2L+tpZgCdGe+PoIJaKFlUyLnMzM5LBK5lOd0Y3T+broKMY9ebm 24e0n76jF7fd7jrQMCgNow3OhKDH1NhpISnmjsFQGZdJD/bzm2N3BVb4wAUk+8bV85B4vI yKIV+bjgfFOyD3Pq5PO33yqphVrqSGA= Subject: [PATCH v2 01/20] lib: move memset() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <48444e14-5c38-efc2-b9d8-2802678c0639@suse.com> Date: Wed, 21 Apr 2021 16:18:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US 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. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014748; cv=none; d=zohomail.com; s=zohoarc; b=IHkPL20PwTHWHoM4VFP0zEeZGdtc3WhrQJndzu+onBcWm2Ofk+TOd1wN6Mrt5WG9Vyk74F6QgFIVJkG6cy0g915n/i5guyGooA93bkkZUHgMnZ+fWivpno+ogT2rAGbeClnhr7nJfP9WEUip7LI6jWFLQR+ZE6SJHka9o3gfFPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014748; 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=FiBwCz4dwAqT37AlnbBbOZ4vWqaWoYHBKFYgRm0agTA=; b=MXUBozmOzDYst3cNysOfV9yYLACSWS0v7pwQYoNreUUN716j5iC8gUCxJsCO/Y1c/FiJPFkQh9yFu7nL8llbtraq7qkePC3bPL+jlHBF2k5tC0nZXItgayaw+O1quoHQidV2LFPxMkENcQd90mPoMifAXGXJT+m6i/u+gyUDKgM= 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 16190147485298.952755637312066; Wed, 21 Apr 2021 07:19:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114605.218442 (Exim 4.92) (envelope-from ) id 1lZDgt-0000hL-9j; Wed, 21 Apr 2021 14:18:55 +0000 Received: by outflank-mailman (output) from mailman id 114605.218442; Wed, 21 Apr 2021 14:18:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgt-0000hD-6p; Wed, 21 Apr 2021 14:18:55 +0000 Received: by outflank-mailman (input) for mailman id 114605; Wed, 21 Apr 2021 14:18:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDgs-0000gq-8w for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:18:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id fec5f106-5e72-4f63-a3b6-08936010f98d; Wed, 21 Apr 2021 14:18:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7712B4A7; Wed, 21 Apr 2021 14:18:52 +0000 (UTC) X-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: fec5f106-5e72-4f63-a3b6-08936010f98d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014732; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FiBwCz4dwAqT37AlnbBbOZ4vWqaWoYHBKFYgRm0agTA=; b=RoT/kousnB94ZwZVfCZHkz6zIqAIF94qOdwqe8b8ZGrMs3mrTOFwd0zBBF6etjPu4LEumS /MAUd8Y8+tTEfvKc17gcJw77ZMCuuFthejAVH5JM13ch92STSiWm6fF38f3dLJJY9cDwsy EeYCzB+7/PkDjRAxmbhBZkkjw/Er8Q4= Subject: [PATCH v2 02/20] lib: move memcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <0d651bc9-c877-949b-ff04-937f19fa9f89@suse.com> Date: Wed, 21 Apr 2021 16:18:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US 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. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014786; cv=none; d=zohomail.com; s=zohoarc; b=iMRZ9m8jMzT2RWIGo+KEtoTaWCY3mTLOqTFcQH7+jk9gHjuk+uNPpps7/AmtiiQU5Kd+lbn1PZUeVjkW1sGFE43TexxSCNuKjLU8A2voHKmtWXketTzHmTlAN9QlT2Y9ws202vAy9Gq7fPwIVgBNFaLXGSIywoCmFoRRNqWB23c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014786; 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=4R2Kmdij+h7UMUrUU26n2n0qiNSiY0BDhxk21aCtqCI=; b=gireflUl9GtaC0urHG3usTVcmXzOKrXfnsXyQbE7FsnvgWsOqNVHMpJ1SkRoLVJXizSzoob/0vWaynkKd17SkN5LcIxj3n0+dC8zHZbqcZJmY49YgqG3PLXz4zw3dz/kag30sNyAS+9w2oftgP56vNz/WZjb8/lSb0fUBX029P4= 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 1619014786832869.552115315583; Wed, 21 Apr 2021 07:19:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114621.218454 (Exim 4.92) (envelope-from ) id 1lZDhR-0000q3-Ky; Wed, 21 Apr 2021 14:19:29 +0000 Received: by outflank-mailman (output) from mailman id 114621.218454; Wed, 21 Apr 2021 14:19:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhR-0000pw-H9; Wed, 21 Apr 2021 14:19:29 +0000 Received: by outflank-mailman (input) for mailman id 114621; Wed, 21 Apr 2021 14:19:28 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhP-0000pn-WC for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:19:28 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d9f37bc2-d12e-4e4e-9f66-14e3e0d0ac09; Wed, 21 Apr 2021 14:19:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1DEF2B4A7; Wed, 21 Apr 2021 14:19:26 +0000 (UTC) X-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: d9f37bc2-d12e-4e4e-9f66-14e3e0d0ac09 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014766; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4R2Kmdij+h7UMUrUU26n2n0qiNSiY0BDhxk21aCtqCI=; b=bNKJ+PNDRzGe6beV8YHwPrAavJRdDodGVVVAJEOOgCxUJWLIEsypNxa2npUXjO995SYdKs 7jjk/R2u3blnPbtLHfi5/8UTFmUHHlZyKIP6q7aBqGA935G0+o2LNDlUMqSPwdTPZsvVuN uUXANBw9o1HfAKGsmJn6poxD1zaz50g= Subject: [PATCH v2 03/20] lib: move memmove() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <2eb9714b-3506-1216-1ce8-35ea000a37da@suse.com> Date: Wed, 21 Apr 2021 16:19:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US 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. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014801; cv=none; d=zohomail.com; s=zohoarc; b=aPSJ3DwXetxIfom3iQZeH2NTJHI+Wuo6xNA1jGd33E7l/loBppgtc8R8MWl+VHe2m9u19PTA8ADUo1bW2a/OgrCXNoWNobcHdpRA17Lvs3Jxogzd7nxycHURpyLUNKJLPh3TCVe1FWTwSOB2QsOCqeEnyVP5oR66VqJTt0IgVIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014801; 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=nduKn0BMFGqCtcRpgHoipLRjh1wYJIQ6hbGO3WbSEd0=; b=GoiS3+yL4IwtM8cub4GfXcyPTx/rs7lqgh9V+lVqbleJB4Cm9DlI5BoOM3qxHKfHLGF3rsesqvfaBVrSbPSH0BewRXllC0uRoPTsBAdYiZssyfxIP3zPBrQpBV8hsCwxviO1WBqWtGAgQO2jCDs2J9G3wj7Ipu6yl65+1GFGgAU= 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 1619014801531519.085668293201; Wed, 21 Apr 2021 07:20:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114625.218466 (Exim 4.92) (envelope-from ) id 1lZDhh-0000w9-2S; Wed, 21 Apr 2021 14:19:45 +0000 Received: by outflank-mailman (output) from mailman id 114625.218466; Wed, 21 Apr 2021 14:19:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhg-0000w2-Ve; Wed, 21 Apr 2021 14:19:44 +0000 Received: by outflank-mailman (input) for mailman id 114625; Wed, 21 Apr 2021 14:19:44 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhg-0000vn-D9 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:19:44 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2243289f-97a6-469f-b304-63de479f3aa3; Wed, 21 Apr 2021 14:19:43 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C41A4B4A7; Wed, 21 Apr 2021 14:19:42 +0000 (UTC) X-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: 2243289f-97a6-469f-b304-63de479f3aa3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014782; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nduKn0BMFGqCtcRpgHoipLRjh1wYJIQ6hbGO3WbSEd0=; b=t4Tz3tvwkS9qeGbkvd3KI3Ps3AD8rgXfGOM+eJVgCvimaTNM43sf9FGmUaC7b0haim8u2b nWVhVVmVHzE0lK1+Kdi3WghSiAvY7XyMLhWJ9HZYFJzPh0nKYNp4rQyF8gwsnbevQdzYW0 xtxlj6CkQPLaQwIx1MHkji/cxHVhD4Q= Subject: [PATCH v2 04/20] lib: move memcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:19:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014820; cv=none; d=zohomail.com; s=zohoarc; b=JoCQIbVxUx0ofLbPHURUfBzTKrl0SHc8DQnnXeuks0Y113HL559bEtSjcz5bAX+sSJJFYibNP5a7msE0Z/4DKl3IWYTb7RnL+1CrZYZEsKBY89reFqxje1QhFyWSFmvOTUzi+SiyA7KZqEybCaYP10SB4golY0kej2ymUKav2F4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014820; 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=LMbNhxvtMq9ZbvXRz7K3D0FtL1970oZAtxN+hjxjzs4=; b=gBeSamVczjL4AiZ9lIFN1rxF/bH7pAFk/vwrm5pPf3DO9d7Nzpp14uOKOWy31Z88A1Nmc3KZyl5psypPD+PG3WDRuvRcWlHWMdwwh4c1w+Po4baH+UfQZxVwESP9WL+IP51KvkE+fCboZ0wFznMI5PU0A+EtQxVSb4k62YPKR4s= 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 1619014820685859.8830832293396; Wed, 21 Apr 2021 07:20:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114629.218479 (Exim 4.92) (envelope-from ) id 1lZDi0-0001Pu-B4; Wed, 21 Apr 2021 14:20:04 +0000 Received: by outflank-mailman (output) from mailman id 114629.218479; Wed, 21 Apr 2021 14:20:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDi0-0001PN-86; Wed, 21 Apr 2021 14:20:04 +0000 Received: by outflank-mailman (input) for mailman id 114629; Wed, 21 Apr 2021 14:20:03 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDhz-0001IQ-HO for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:20:03 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8e7d62fd-09e3-4208-ad9c-2218983a4961; Wed, 21 Apr 2021 14:20:02 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 11B76B4D2; Wed, 21 Apr 2021 14:20:02 +0000 (UTC) X-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: 8e7d62fd-09e3-4208-ad9c-2218983a4961 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014802; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LMbNhxvtMq9ZbvXRz7K3D0FtL1970oZAtxN+hjxjzs4=; b=EUS0ZLZr56tjgYiJxWjYk/08qI0ufPHLI2Pl4Boo14WdDZS3BLanwY/I4CtlBce05GfZsT siFoNCbyUuD7D7y0cS5Rww2VkUWv9CYH009c9soHCW3Htocj3nKk6mKCgV3tvMzdvboc+3 cLxN0APDV1U9MD4XCnndNI/Cpw8EhRo= Subject: [PATCH v2 05/20] lib: move memchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <50a77bf7-e35b-be24-9cc3-a1691e7c7f90@suse.com> Date: Wed, 21 Apr 2021 16:20:01 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014840; cv=none; d=zohomail.com; s=zohoarc; b=Oq9Y3M1ETHie63zmbleS0dKSO9E8tXK1mQmQ+OfqU12aPrdHKuFvAJCs+TCkS4O6+ITIWDENorPCXOk0mFL9TvisSmAR04Lq23P6vKq4G6tKWDW6joNQS3bDxnQgrTjLZKrtzUYUO9BhiRDQubx64/cRv4/D6Q2MhNdexiM9rAc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014840; 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=5hNPv/9z1szKdd0KceZZSiWvREDVh3EkEtocexi/+Dc=; b=GAs8WEybNEXwNLBusCIC+5T8jyRFq8TY5EMqfWdJgIo3miGT8mkb8PUNwAu+2HliiuyFIaCbqqEpGi0oOchVBBCuHxFgeX9CQR9iJhXXKjpzO99jvcZ+PFEqQvdUaVhHCoekQBL9QiP/1lHD16OXVyUgSHXQQUHUdz9Ttu1+dyM= 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 161901484034470.01052385289051; Wed, 21 Apr 2021 07:20:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114634.218490 (Exim 4.92) (envelope-from ) id 1lZDiN-0001qu-JE; Wed, 21 Apr 2021 14:20:27 +0000 Received: by outflank-mailman (output) from mailman id 114634.218490; Wed, 21 Apr 2021 14:20:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDiN-0001qn-GL; Wed, 21 Apr 2021 14:20:27 +0000 Received: by outflank-mailman (input) for mailman id 114634; Wed, 21 Apr 2021 14:20:25 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDiL-0001qS-OI for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:20:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d46683da-66f3-4c43-8f60-c9cf69430d10; Wed, 21 Apr 2021 14:20:24 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 166D2B4D0; Wed, 21 Apr 2021 14:20:24 +0000 (UTC) X-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: d46683da-66f3-4c43-8f60-c9cf69430d10 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014824; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5hNPv/9z1szKdd0KceZZSiWvREDVh3EkEtocexi/+Dc=; b=Id8kVtUTkHiZARNT1JFvqAD2xH1LaSYZwsb0d/lLxkT1oGtjumfNxmJHuzOnxl+5L0B78f bbcfbd/SUajksZHOlFmPc/7NsLQ9SuQNLfOIDNH3gRciz+nUOhnBLbRJLbksInc7CsD47/ +QRwXQwrZWSj2sUhv0+1fk8WVW8aKhU= Subject: [PATCH v2 06/20] lib: move memchr_inv() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:20:23 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014941; cv=none; d=zohomail.com; s=zohoarc; b=oFNwf5obS8mGHLqUlxVBYmvaCkjDQOxGSKiHUX40K2YobpKa5WW8/5fnPjgNyXqLA/fS/2Ual78UecH614/sqdnHpTnq3G5QTA6nohPk88SOfvky9FBlAUZ1Qky3h9GfdE+bNrZLRHX0/HoOgkALP8tIzcCMTrbYZ/1XZYz8p0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014941; 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=E+n1hqpE+sLl3vHGQjm07YiejYA4S+f1I/11X4roUSw=; b=En54aWqAPSUl6y98R7w4jFVjR+ZxO1i4IyXg/OGXg154zgkIC1HEFARb+ae+IGw8GoIw8ZfAxbn/+xR4fCxxE2sQWD6i+0CPh7R4UlXwHmrt5Mm+Q4fyS+lsprBvsdzYBL3XkvBAhVs8/88WWDO8JGuE4V9Fr1yXOQjEXqwbUeE= 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 1619014941048636.8304823415637; Wed, 21 Apr 2021 07:22:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114647.218515 (Exim 4.92) (envelope-from ) id 1lZDjz-00028Y-7Y; Wed, 21 Apr 2021 14:22:07 +0000 Received: by outflank-mailman (output) from mailman id 114647.218515; Wed, 21 Apr 2021 14:22:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDjz-00028R-4e; Wed, 21 Apr 2021 14:22:07 +0000 Received: by outflank-mailman (input) for mailman id 114647; Wed, 21 Apr 2021 14:22:06 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDjy-00028K-Hw for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:22:06 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f3bb62b6-9a44-4c09-ac87-6e0aec27326b; Wed, 21 Apr 2021 14:22:05 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D6060B4D2; Wed, 21 Apr 2021 14:22:04 +0000 (UTC) X-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: f3bb62b6-9a44-4c09-ac87-6e0aec27326b X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014925; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E+n1hqpE+sLl3vHGQjm07YiejYA4S+f1I/11X4roUSw=; b=GWdvtYx/UY98X7otMWxLgJo2F/xrKGnUu4cIBfb+GQU6aeAGiH4LY6jt8wW0BzgUNkgHK9 WTApM+F+O1Cr/l/VYTRhc/+iQqeoP8HnD/LdILiXI/lnoy5/A/Z3sAGe/ywLJqX5RR/0q9 aS88jkeo8zJKJjnBlMho1hT6xHzY46k= Subject: [PATCH v2 07/20] lib: move strlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <96f1217c-d6fb-d83b-741a-2565890ca43c@suse.com> Date: Wed, 21 Apr 2021 16:22:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014976; cv=none; d=zohomail.com; s=zohoarc; b=TBBa+C3XfE3PuSnGfKmVOxmP7ZGgXQuC6u4uX6rlCQeTChoN8O4shlTbBxfHtGNHO5HuSb1ud4V0FDd7p6m45QYMXCtHEa5gr+WlGp82wfSKpxFDqpeH7fZQ/EE0TyK48UcbsjvI1Ie0WphQqWj+0VhvSLXZ+RS1GRkHGA8uEVA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014976; 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=Fb5KI+bAQ6MYv9PFZSi0Iz4GZ8NUhpIj7sV5bfwnL9o=; b=KVwvqk4Lw8M7UftaVfGMoSvACO8CRnZXfBRzZe50MX1E9kKhHgkMgEGzAeOPdIzfki3Nw66vkPJ7ruJmaKXdRQ3SCBtoLh4g1NJbyl/uNfED6ByZi6BSyXNOl+h8kW9JslZEprD3WqPgY4sM19R6WQkyukjto15bPeBfDoo+KFw= 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 1619014976564142.97716391589438; Wed, 21 Apr 2021 07:22:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114654.218526 (Exim 4.92) (envelope-from ) id 1lZDkV-0002G0-HF; Wed, 21 Apr 2021 14:22:39 +0000 Received: by outflank-mailman (output) from mailman id 114654.218526; Wed, 21 Apr 2021 14:22:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDkV-0002Ft-EN; Wed, 21 Apr 2021 14:22:39 +0000 Received: by outflank-mailman (input) for mailman id 114654; Wed, 21 Apr 2021 14:22:38 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDkU-0002Fm-M5 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:22:38 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 28696678-3e3e-4639-8fbc-4d7c7062a3d3; Wed, 21 Apr 2021 14:22:37 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F37E5B4DA; Wed, 21 Apr 2021 14:22:36 +0000 (UTC) X-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: 28696678-3e3e-4639-8fbc-4d7c7062a3d3 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014957; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fb5KI+bAQ6MYv9PFZSi0Iz4GZ8NUhpIj7sV5bfwnL9o=; b=eMbeGQRo/x1qjbuNC8P5EH0YE+v/PxmWrDsnwBJ3KMwsZaJbaRnk38zybDlS5m9sxmXDQj 52775amAI3M37xtMtsBFJ6l9YSAA4ZoM2j1hk6+fPEvMxB9wADSsBiB/BdoLiK/5pbimxc /zAF63px+MJtppqvSJwKB6ldq2Mc4K8= Subject: [PATCH v2 08/20] lib: move strnlen() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <74e09e4a-1a67-b616-8c56-c5dea9184871@suse.com> Date: Wed, 21 Apr 2021 16:22:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619014997; cv=none; d=zohomail.com; s=zohoarc; b=BAt5DCHhiuhSzrZ/5dR+PvorRK7uf0gVvq8OH+uIC1KaUriMCiNXhH0j4BiAZhj6mM4MxVgrn+P/xAk+xMqmnVwAuy89k87nWc0NaqU/wHfB6icGknjfz9zfEv1aAcr2LZ5Df08qcZvXT4fcAfYhB2zC2pUbLlIaJsTsT0O82cY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619014997; 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=s2DVYdfxyAMF+b+0oBREdJVxrIb85Ue9nsEafhsVnbY=; b=GDXlHJN7wDVTNs4y+GuOO3r4rfUXoJIJQ5uL8TuqOITLorwXTztBWoPi9/vehBop41U5ylJPDIvrZyLjduaoeeEKkjZpV0NLr+kGJp4E4xI8Vn/gFGImpbQZK3cs00HOhO+vz1cAwLgeNi/szHjqXMloTQu0jPv/iW+GtyMkyIk= 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 1619014997129197.2740164853111; Wed, 21 Apr 2021 07:23:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114660.218539 (Exim 4.92) (envelope-from ) id 1lZDkt-0002NX-UF; Wed, 21 Apr 2021 14:23:03 +0000 Received: by outflank-mailman (output) from mailman id 114660.218539; Wed, 21 Apr 2021 14:23:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDkt-0002NQ-R8; Wed, 21 Apr 2021 14:23:03 +0000 Received: by outflank-mailman (input) for mailman id 114660; Wed, 21 Apr 2021 14:23:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDks-0002MI-Bm for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:02 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4347b79d-625e-44e1-b82a-e6cbfdd24b24; Wed, 21 Apr 2021 14:22:57 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id AEB12B4DA; Wed, 21 Apr 2021 14:22:56 +0000 (UTC) X-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: 4347b79d-625e-44e1-b82a-e6cbfdd24b24 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s2DVYdfxyAMF+b+0oBREdJVxrIb85Ue9nsEafhsVnbY=; b=rmwtaRcRU2+aEdA3K40YlM7uhrDJfsU3cxMgPTX2WPN5uWwpx/Indj5hEO4GfZZgR8C3R4 VReTu2zhAST3Mk8l/hw4J8tOM3SvCXdtIj4oz5n6itfdRteUC90syytvOnyjQRatrA199p Fi+8RWzlFtzcjXxlkAy+H3j4BZL813I= Subject: [PATCH v2 09/20] lib: move strcmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <6fa3ce3e-30bb-c429-caef-64a66717cb13@suse.com> Date: Wed, 21 Apr 2021 16:22:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015013; cv=none; d=zohomail.com; s=zohoarc; b=e2DZnFtpwpFBcWFx3TxbwhMDnK3XaBFD2gwmVr/Jlk9t24LxiYeVfd788PXxzQgl5JbszgFFqW5u5rkFWA0AVQyetPXaIyqMnrhnpEbC6Ko5ujllUiPbxRpl49Equpb/4T4/JyqeuRp/U1kUqyCUUGXVcn5cFmPH5GNDBTibQzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015013; 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=4FvIXCowx2UIw7V4q4GB2nIMWZ/2oM6HHFptc5wvIQ8=; b=c41/Wk4K5R+iB3A2qyddcajUDflLyakhSqZGXT19wgBw8x7lDLLXa2iSaAvjpz0wa4drdck5A4JYmgJ+1RFWmFVJP0Xjj+vDvKH3j4T98n3qG7Ga3psdEnVAB0K8sFTT4ZEWPTBv1xxr8a8ezTX77o46btshDXEr6BvlbqQ8ZxQ= 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 16190150130151004.7288829880775; Wed, 21 Apr 2021 07:23:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114664.218550 (Exim 4.92) (envelope-from ) id 1lZDl9-0002TO-76; Wed, 21 Apr 2021 14:23:19 +0000 Received: by outflank-mailman (output) from mailman id 114664.218550; Wed, 21 Apr 2021 14:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDl9-0002TG-41; Wed, 21 Apr 2021 14:23:19 +0000 Received: by outflank-mailman (input) for mailman id 114664; Wed, 21 Apr 2021 14:23:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDl7-0002Sw-BO for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:17 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7999c33c-c299-430d-bc2b-59c0ff8eb038; Wed, 21 Apr 2021 14:23:16 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DA28FB4D3; Wed, 21 Apr 2021 14:23:15 +0000 (UTC) X-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: 7999c33c-c299-430d-bc2b-59c0ff8eb038 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619014996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4FvIXCowx2UIw7V4q4GB2nIMWZ/2oM6HHFptc5wvIQ8=; b=ay8w0YO2HC27wz0Yo6SJyxWVFYHEuthkRbAM+iqFpR4IwV+diAzeOOV03bvOeDdpWngkLa Cp8JS7FVNgbnjZgPvu4rq5OyVVbFPogJ+byPgvO3aXcW4DE1G24sw0c3dZQJtgZiG8xIOt D3f8Pw00Ai8p8ooizDG3ilHxePf4tj8= Subject: [PATCH v2 10/20] lib: move strncmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:23:15 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015037; cv=none; d=zohomail.com; s=zohoarc; b=QOdKHKfABSy2QOJK86u/X8cINiC3PcR8MpzmkIEHJFverK+SyDX3wAMS0uSh9GCuNC5VUFGE9SIkHEp9GN3bd7O1L+aTHqbsSnthnuX+LntSfT3PRC14Dk+xBJCHjjsigNPIA1Vl6giFtSxRpR6Fs7Y5rkwyU1/fedd4S8pcLU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015037; 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=mtUcSlpHHim8EO7pSYWk5WfxwrY5tNdvwHjshpV4nUg=; b=ljdzDrvfwd4hrldKqRLErnJ23MH8zeZFWBL4mUop+bMo0y4naY8VtTqvcK55YMPOrmY6MDiDCYXbaWhXgbDB7ShbDGNQ8/fXDHFBMs8DmGvep+19w+EV75n4C5t7w9fIucwFtCAKQnrzQ0EU6uJtrU9vzxHs+/qjZ/vtmQVCZWA= 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 1619015037261953.8968624282242; Wed, 21 Apr 2021 07:23:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114670.218563 (Exim 4.92) (envelope-from ) id 1lZDlW-0002aq-HK; Wed, 21 Apr 2021 14:23:42 +0000 Received: by outflank-mailman (output) from mailman id 114670.218563; Wed, 21 Apr 2021 14:23:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlW-0002aj-DK; Wed, 21 Apr 2021 14:23:42 +0000 Received: by outflank-mailman (input) for mailman id 114670; Wed, 21 Apr 2021 14:23:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlV-0002ab-U8 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:23:41 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e1db7945-0e4a-453f-9bd9-22c4fe0f026c; Wed, 21 Apr 2021 14:23:41 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2E0DCB4CD; Wed, 21 Apr 2021 14:23:40 +0000 (UTC) X-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: e1db7945-0e4a-453f-9bd9-22c4fe0f026c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015020; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mtUcSlpHHim8EO7pSYWk5WfxwrY5tNdvwHjshpV4nUg=; b=IoZRbRJQcDB5xriNzS4AlksbtOJbraURm986uRG2BAYge0bJtNBXCYR8bSnBNgrA+qtzHA e3YARfvapfUS6rr8I1QY6Do61fpM/39RE2bFcPuHgzKlHSyBKk+v3Z4CBTDcX032OJPyHe 0wGb3HHCObmwxSGeJgVkrCucninRZtg= Subject: [PATCH v2 11/20] lib: move strlcpy() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <0e2d802c-f43a-6028-870b-55ae4234559e@suse.com> Date: Wed, 21 Apr 2021 16:23:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015062; cv=none; d=zohomail.com; s=zohoarc; b=WVCFCZ5Ymhm00UUAzCp4gLhIL3KEXIrINjcjj2K90fIpGKdf6smbK3mtCZF2j6H0wEkEtowKRUfsR3wwkbgJhZEdtaA4kRlR1dY2s16aCQzlNy5zIYNIwGH1MLkUHQsQpxZejXvZ4YPI/2CC7ZmiaWX9eO5m1nYnhorNvySqBew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015062; 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=Qptv3sDhy3glLo/iGAHFmZQ2Uu0levQpMb7ZH5gYAjo=; b=Vu0dmr/sQWi+dCwuwJDd+ed7BS+mRK76uUMYOkvEIWfOG/XKZb/h+oXVn1ibNVjMYjjhcg1rrZXuC7eJCjjcJ52zmmz00bCd9bujL+lKlWcnX+GQ4CW8S+wOVXJx4PoZdT5dB2Z/i9qVnKTqR27wI+EhzVOtcwHsphX3hcCqH5g= 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 1619015062217772.4256200771365; Wed, 21 Apr 2021 07:24:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114675.218575 (Exim 4.92) (envelope-from ) id 1lZDlw-0002hk-RP; Wed, 21 Apr 2021 14:24:08 +0000 Received: by outflank-mailman (output) from mailman id 114675.218575; Wed, 21 Apr 2021 14:24:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlw-0002hd-Mu; Wed, 21 Apr 2021 14:24:08 +0000 Received: by outflank-mailman (input) for mailman id 114675; Wed, 21 Apr 2021 14:24:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDlv-0002hS-Ob for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:07 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9d84c05e-1612-47fc-af05-0f30e0f543f0; Wed, 21 Apr 2021 14:24:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 40AD3B4D0; Wed, 21 Apr 2021 14:24:06 +0000 (UTC) X-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: 9d84c05e-1612-47fc-af05-0f30e0f543f0 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015046; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qptv3sDhy3glLo/iGAHFmZQ2Uu0levQpMb7ZH5gYAjo=; b=jmordhoN2zOGSVSBlRXfCeIiB4vdFvR6Hr7ADEqqUi2/h/hIE+Nelryqu1kvDpJhUga3fq 909PMMrhIBEw2HNspd45ZcLJn/UKrVS9ZowJVJpz9/Wz9lL2gURCMEYrAAzD/IWR6kk6nx UeJ/8JeeeJUQV7bdfmNnDsJFm5htCLk= Subject: [PATCH v2 12/20] lib: move strlcat() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:24:05 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015087; cv=none; d=zohomail.com; s=zohoarc; b=n2gMa7/bj+6FSnFCZmx9BfvYnRiAD9wu2S3iKDd7tDNQD+1bY1yK4TrqxH8JQ/jSoGc1eTit+2BTff5H1m6V1fQdrPLHxG+Iu5swUkZPHbjGt9q/rWE3F7CFl8wslHjb+TaaicQZM6f3lkYsVlzAyX9pRayBnFlxzwNcJjgf/0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015087; 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=Ta/mZ1J82vj5/njhIij2ZDZGYO0U9Eh6iVWMMmSf2Hc=; b=VuJXvi/TFDAyK/UNEAxreZZ+wP0dTiCxi6yjBL7zeuZPMs+vmYAZ90ddByB/jS4zbIUzCRZes6Ail5Nka9xg/6jm0ce/LDQjKMHQEILYQ/+CZe/bgh8HzaNaRiqEtL1v3Nraw9yGmkLmcmmHHqH9ittQZK2bSTV/A82DrVcvFNE= 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 1619015085946109.33386393413718; Wed, 21 Apr 2021 07:24:45 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114677.218587 (Exim 4.92) (envelope-from ) id 1lZDmI-0002oa-3w; Wed, 21 Apr 2021 14:24:30 +0000 Received: by outflank-mailman (output) from mailman id 114677.218587; Wed, 21 Apr 2021 14:24:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmI-0002oT-0j; Wed, 21 Apr 2021 14:24:30 +0000 Received: by outflank-mailman (input) for mailman id 114677; Wed, 21 Apr 2021 14:24:29 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmG-0002oH-U6 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:28 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id feb0e4c1-2b53-405a-80f1-ccfdac92d2b6; Wed, 21 Apr 2021 14:24:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C15B6B4D5; Wed, 21 Apr 2021 14:24:26 +0000 (UTC) X-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: feb0e4c1-2b53-405a-80f1-ccfdac92d2b6 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015066; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ta/mZ1J82vj5/njhIij2ZDZGYO0U9Eh6iVWMMmSf2Hc=; b=mQQW/hnM6g7wVezvow6KwkOfMjTW4xX9c95THs01wF5RLNiaXDOrPp7vwvBhG4noXyLonW +ac+oz9S/nIHSE1CBN8Ury5ALBJLuS/SyQzFGwt3bgosWPHyCbUw/7SzJ8HULTiVGdWZd0 j4kfoCDxfSfeQoDnaV95EMbHT30SlAk= Subject: [PATCH v2 13/20] lib: move strchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <92e18a3e-bc49-e197-2254-be86c281dbe2@suse.com> Date: Wed, 21 Apr 2021 16:24:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015138; cv=none; d=zohomail.com; s=zohoarc; b=gCIg+n4ogItsmcDc94eGUtdqHBs+q2u0nkapuqGmNHAW12j8V4CRUe9/0KFfTwozAenE0Z0HIJo18cloPq8l50iwuvC7Xb73V2JdidjbZdbJ3iOVK9TjnDcnElkYBEVBvJKH/APTa7jVUUhi1D2gWpCftNY3MQ1ezrGzbbbuG30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015138; 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=V2D22MGhvbC7x5CodaleCmbDoeONjuiqLIbZE1iqDYk=; b=JnvItqU13cM32U3mDL0/qD1owHE7BHudu4sFH6h6mgiviqvVgQhSPAXNGLHTiTMCJJk01EcH9h7cdqutNUtmDApjpLyeuELlOYTgKvAiTDqnJblX33cQX41FJa/8/h4JHli5lxqXLP+LBvyugov+m3vPMryb9aIqd4njPjr5YIU= 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 1619015138483959.0380627024488; Wed, 21 Apr 2021 07:25:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114682.218599 (Exim 4.92) (envelope-from ) id 1lZDme-0002x6-DB; Wed, 21 Apr 2021 14:24:52 +0000 Received: by outflank-mailman (output) from mailman id 114682.218599; Wed, 21 Apr 2021 14:24:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDme-0002wy-A1; Wed, 21 Apr 2021 14:24:52 +0000 Received: by outflank-mailman (input) for mailman id 114682; Wed, 21 Apr 2021 14:24:50 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmc-0002wc-Og for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:24:50 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id dd2df82c-3b11-4ca6-887a-cab46643fff1; Wed, 21 Apr 2021 14:24:50 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3DAB9AF65; Wed, 21 Apr 2021 14:24:49 +0000 (UTC) X-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: dd2df82c-3b11-4ca6-887a-cab46643fff1 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015089; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2D22MGhvbC7x5CodaleCmbDoeONjuiqLIbZE1iqDYk=; b=q76qnLu3ns85impPYj76blrulor0DQ4UeXkLZLLQ/FcON3gec5Oul5km4Usf4yaQKjueHu c0ddaYBQYyG4L1DhD0R14wxZLJaoTz4tct6QcTkSxKfeGVIutbuo4+UxMg2D54EutALDQX tj7djIbMlmxCFFPSdiSgRMKuzSxU+Yg= Subject: [PATCH v2 14/20] lib: move strrchr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:24:49 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015123; cv=none; d=zohomail.com; s=zohoarc; b=BD886bVX8Xa84lMAHVrHjQUQamxQR7CGzgZx/jgdUOHev4r6JkIlElh6po0GJ7//Ph9jl9xM/a5vWNjc/+abRT6Nxtfzta6IZJei7uUlx8Iaygkso9Sc0qak3Hx1kidTRQ75GKOGYSKzes4M1ExnKQPfsw/xOQxTE8PtENJPSEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015123; 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=8QhvMzXM/i87KvTemiF5H1HaQ7XQjeqnJIEG17bkRhM=; b=AiqiTmLLnRj3nScBtVOnYkwGQF3RfawFYBsGlloa9TyyWSmaLxLNCC2OGXql/n//936NTJO7KuEsKbcgE4sfKG3pQtUugDhq7mX+Opw9Z4LwnEwdIwffigxp6JlAFwNQxWH1DusSfJfUcfBFcl4YXZlsxYbl8SWUuNJw02vRwW4= 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 1619015123872596.3856211420924; Wed, 21 Apr 2021 07:25:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114686.218611 (Exim 4.92) (envelope-from ) id 1lZDmv-00037R-Lc; Wed, 21 Apr 2021 14:25:09 +0000 Received: by outflank-mailman (output) from mailman id 114686.218611; Wed, 21 Apr 2021 14:25:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmv-00037J-IS; Wed, 21 Apr 2021 14:25:09 +0000 Received: by outflank-mailman (input) for mailman id 114686; Wed, 21 Apr 2021 14:25:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDmu-000378-A7 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:08 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8a525680-f73b-4ea2-836a-3110f4070247; Wed, 21 Apr 2021 14:25:07 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CCAD0B4CD; Wed, 21 Apr 2021 14:25:06 +0000 (UTC) X-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: 8a525680-f73b-4ea2-836a-3110f4070247 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8QhvMzXM/i87KvTemiF5H1HaQ7XQjeqnJIEG17bkRhM=; b=pUfnmEZN0+1UKyLaoepXW/lcPsD83VUY7OWw8pkI3d/HBH5tRxqb27rTjwHmGFMEWGoWA8 ghEJ+kQzKpkyGqRv6GdKe8JWHTSDgWWYGEmshycVHVLC4ARpbu0YRSWUmmU8k4dAHKdhLk BX0X3sNdyWsht9zTxQwweYBbir4OG30= Subject: [PATCH v2 15/20] lib: move strstr() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <8a44fe36-be00-cfcb-2597-b14b4d4e500c@suse.com> Date: Wed, 21 Apr 2021 16:25:06 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015143; cv=none; d=zohomail.com; s=zohoarc; b=Z+PrwOqaiHa70kgzK4GbVM1U4lyvmEwq2ExBGK7Mi3PSW09BATWKiQB8V54irzQ+jO8fauB2uTlQFhA/vCX8zS6OFDk5FTsS1WXBtiIXF5TMrjqgHSEWIGUBg+XEMyUbkyHu4nf7f8h4MJP33N96iDrSfvlB9IAV+GBS5lw3ens= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015143; 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=nmQ/c7gIzOZRlLH5fn36bOJsiqI2Th1uZDRwEg8ZZNY=; b=J16xpaUGoCSFbMtEFYL29dwF+eA5H26Qb2VE96PUBtByuxcEII9DrIBXfyK5snHT5ikAwVNpIWQT6E7wQXxJzj+97uCMwgcDgO3A7j57w0n8GU0FjplGXIPMMzCSmF4/Q6smycj/nP5UHA5L1nEQQdCAAXZAExwVDuqaPaAAqSg= 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 161901514372018.081118258760398; Wed, 21 Apr 2021 07:25:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114692.218623 (Exim 4.92) (envelope-from ) id 1lZDnH-0003Gn-2Y; Wed, 21 Apr 2021 14:25:31 +0000 Received: by outflank-mailman (output) from mailman id 114692.218623; Wed, 21 Apr 2021 14:25:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnG-0003Gg-Vr; Wed, 21 Apr 2021 14:25:30 +0000 Received: by outflank-mailman (input) for mailman id 114692; Wed, 21 Apr 2021 14:25:29 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnF-0003Ew-JL for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:29 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id acedf932-278d-4352-b1f6-14c048ce1ed4; Wed, 21 Apr 2021 14:25:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 13106B4CD; Wed, 21 Apr 2021 14:25:27 +0000 (UTC) X-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: acedf932-278d-4352-b1f6-14c048ce1ed4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015127; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nmQ/c7gIzOZRlLH5fn36bOJsiqI2Th1uZDRwEg8ZZNY=; b=CEEei5MJcJLUjt4oUg8/clwINple8IwJTULy2r+bZYZxZ/GbYtbp9gL5DR4sxCVuc9Emio RqqZCJJt/MSsTtiAecObp7mBC0mAgTsd8CjKh0LWfNxBxC5V3eI5Db178VhlERQHJ/E+KN TOCXAwX0NRpL5ogPr7Evim28A+Z7eog= Subject: [PATCH v2 16/20] lib: move strcasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:25:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015164; cv=none; d=zohomail.com; s=zohoarc; b=KW0qnId0yLFMGySDeqx/0B1wDxHnvy+an1LzRTAicCSS/+o5ciHNCEf1Mq8NQ4i73gdzmIOWfKstFaPM/08/WdfyN1SfKP1yntytv3NKXR4fptpYPaIc/0hxmC4Tw8sU0/SObkkPizG+r1eqyqEqPAk4T8L5NCYG0IDZkkXlpwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015164; 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=bOiwld07WhTXpih+DJFsxzfncfqIuvXy8kpeycCOHLA=; b=iKhrJZENMcvrRO0V3rpsdQ4RNx35JBTof93kxHfJIeh63sEVsycJfHXg34I06TQTPx2A7+J8oADdGqxFPPx1FZ4E2kR8Shxuk/fAbVFsliy7UuDwsuvyu71h/Y86o9wOsC1dmLzrrmi0/ozpQKwPOy1s/DBOmKVUq3ZOsjHNtCk= 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 1619015164972196.8703828548929; Wed, 21 Apr 2021 07:26:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114699.218635 (Exim 4.92) (envelope-from ) id 1lZDna-0003PS-C5; Wed, 21 Apr 2021 14:25:50 +0000 Received: by outflank-mailman (output) from mailman id 114699.218635; Wed, 21 Apr 2021 14:25:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDna-0003PL-8N; Wed, 21 Apr 2021 14:25:50 +0000 Received: by outflank-mailman (input) for mailman id 114699; Wed, 21 Apr 2021 14:25:49 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnZ-0003Of-64 for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:25:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id f4cd4473-3831-43fd-a541-b39e8e9c47cb; Wed, 21 Apr 2021 14:25:47 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E4F84B4CD; Wed, 21 Apr 2021 14:25:46 +0000 (UTC) X-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: f4cd4473-3831-43fd-a541-b39e8e9c47cb X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015147; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bOiwld07WhTXpih+DJFsxzfncfqIuvXy8kpeycCOHLA=; b=eAN+ZhDrkq9RX5U6QdCz3DyTvowT4/PQHzOBDHJHwwF6ssGqvM+prkr21rafL9Xv84cHlz A+iHHgoO0nUudLzOGnQjSE0ABfl3dY9fN/RizCQno2HpP5khDtiVrjg50fk61BFLGCep11 kRyhRjSx1dwzfhYFKURRK8P6GxR4T2w= Subject: [PATCH v2 17/20] lib: move/rename strnicmp() to strncasecmp() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <1fab1400-9bb5-f9e8-0f7f-3213afc0ad92@suse.com> Date: Wed, 21 Apr 2021 16:25:46 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US 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. Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1224,8 +1224,8 @@ static int __init map_range_to_domain(co * They are not MMIO and therefore a domain should not be able to * manage them via the IOMEM interface. */ - if ( strnicmp(dt_node_full_name(dev), "/reserved-memory/", - strlen("/reserved-memory/")) !=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 Mon May 6 19:05:38 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=1619015185; cv=none; d=zohomail.com; s=zohoarc; b=Xz9w1AYJims1aFtUrpvV0MAKuNs6leaft//gvmqJXYcdffYrnD9raEv7LXF3CrfPVSAzOCQwmWW/A+zo4V1N/BOkRC4iZsh/Ewf5pEEzswvbwvEeAxxrdD/TYGahOgx2R6TDx/UdIpXqmJUFVLLwJnm3DFRfAsdfz2+A2JtVvoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015185; 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=/ikAXGR+d4BQ68yH7iPulr9qDYJtJu1Q/hYMFGUEDmQ=; b=IwN4lSzqIpyLDNVrVuwD9kayv1sx+gnAi3kUS1NJYilnD1O4SHMG/HqODeSytUnt3a4JtqXjUfk+0EdnETKQM4AZWfzeKR6LKer5BQmqgkFzXuxyBnNli8jyTwTQDDb3EFQhN/FULb2Wsx7g9EjrpLdlLx2uyhV9LLz9w0ruERw= 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 1619015185607627.7816702310887; Wed, 21 Apr 2021 07:26:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114706.218647 (Exim 4.92) (envelope-from ) id 1lZDnv-0003ZE-MM; Wed, 21 Apr 2021 14:26:11 +0000 Received: by outflank-mailman (output) from mailman id 114706.218647; Wed, 21 Apr 2021 14:26:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnv-0003Z7-H2; Wed, 21 Apr 2021 14:26:11 +0000 Received: by outflank-mailman (input) for mailman id 114706; Wed, 21 Apr 2021 14:26:10 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDnu-0003Ys-Cn for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:10 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 888cad03-6053-4b2d-acb0-378bef7832e2; Wed, 21 Apr 2021 14:26:09 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BFD2CB4D3; Wed, 21 Apr 2021 14:26:08 +0000 (UTC) X-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: 888cad03-6053-4b2d-acb0-378bef7832e2 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015168; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ikAXGR+d4BQ68yH7iPulr9qDYJtJu1Q/hYMFGUEDmQ=; b=h9YVw9owsJSwRLAOuwbARKv1fN5XXz07GXtO75c3x9FV8uOXtHa/5VNdPPxxFkhPVq+O0A fQCN26olM7rWvOnEjNa1c1B3kYlRgfb4CfylivRzVjGUQxL3papNGHOGXqoYgWT6/r1PZF 7nlyFKtoXqFUtN/K8JZn8Dwm0hl3+0k= Subject: [PATCH v2 18/20] lib: move strspn() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: <901b2b75-c042-febf-b0cf-a6e7f806b26a@suse.com> Date: Wed, 21 Apr 2021 16:26:08 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. In fact the function is unused at present, and hence will now get omitted from the final binaries. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015206; cv=none; d=zohomail.com; s=zohoarc; b=TK8Nxi/mBiXuRS6vjv9f5HDwB8Ehatig6ojCHdU+QVXkykqzZIcitezTZ8F1bKIM1dyGNtJa4ipUnF6dst7hFfT9fLVJpyNN3JwdiFlTbzDoRu+lJwJ88U9/uIMauiNn2lrVDjTXxi/mgYHG6QOHictnuGu203ogmnkOcJfK0TY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015206; 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=VRhAA1umJE95thm+BkRB0Qw/wbJzne0Yyf6yVGgrwEI=; b=Qzz8FeClfXYYh3sre7QsSzMYgOzk2QoDkPwwaSY/2Pg0pfyBTr6hHUJNLtqaQbdoxxHFdWMwLuwrTcgAKj92R1W1Y7nfL86PTGuV8lCfJekYx87R/XxqNXb1rNGYW7I+4BNIjiITKX9H6xtLiyerwFR51zKkIyUo31fJEPAmKho= 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 1619015206767870.120342762857; Wed, 21 Apr 2021 07:26:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114709.218659 (Exim 4.92) (envelope-from ) id 1lZDoG-0003fh-Ti; Wed, 21 Apr 2021 14:26:32 +0000 Received: by outflank-mailman (output) from mailman id 114709.218659; Wed, 21 Apr 2021 14:26:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDoG-0003fY-Q4; Wed, 21 Apr 2021 14:26:32 +0000 Received: by outflank-mailman (input) for mailman id 114709; Wed, 21 Apr 2021 14:26:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDoE-0003f8-Su for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9862c2ce-2e0d-49d5-98b6-64d5735995e4; Wed, 21 Apr 2021 14:26:30 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5DA1DB4D6; Wed, 21 Apr 2021 14:26:29 +0000 (UTC) X-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: 9862c2ce-2e0d-49d5-98b6-64d5735995e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015189; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VRhAA1umJE95thm+BkRB0Qw/wbJzne0Yyf6yVGgrwEI=; b=A9mqYbg1+HuQbbSNgqolaVaq8+sTSP9mtGA92eWE12ebNllVyAlvbyd6JqskUWy0OlnzGu BE5OPXWo6guzO8kqiH3HR+DCR55GphwwC4sBJbPsRtlhgBAMsDBqphUiO4GtIsLoww1dbJ En/MtgON5csJszRQYVQlFLELudHMISc= Subject: [PATCH v2 19/20] lib: move strpbrk() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:26:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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 Mon May 6 19:05:38 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=1619015231; cv=none; d=zohomail.com; s=zohoarc; b=Obkp19bEGsxfmY+DPXvSaSugr0zgytymX7MK1Eh/ztg1ff8/j1gbFEGML37rNG9KyEgc+nwhsnN3vkwxLD9M988NEm+U4WMBuX3l0YoyQsqi+zel+Z1n6ctdty2gz5cH/ouewUj7jJReyAURvDf0habk4VGsyWjNjTWelsbYT08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619015231; 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=u2H21liw5DO3IL1nQvzkhzYeKaGhal3AQ8PDJbmUMCo=; b=IwOEZYVeaa5+ge0yN9FdfYdLH5zNtgBdkdygTEoU9aBVTpBSAllkytK/CV7ctASOAb9zSn7JltPkVQXyerCyjn9OkP6jk69uAs4HjWVA0ijgaH2EQDghSmpkxXCWxKgZUVtuj+y0Im4DWeuknaVuL40nVJqDWlaulyaKybWP9M0= 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 1619015231221216.59565207584535; Wed, 21 Apr 2021 07:27:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.114715.218671 (Exim 4.92) (envelope-from ) id 1lZDod-0003n9-62; Wed, 21 Apr 2021 14:26:55 +0000 Received: by outflank-mailman (output) from mailman id 114715.218671; Wed, 21 Apr 2021 14:26:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDod-0003n2-2k; Wed, 21 Apr 2021 14:26:55 +0000 Received: by outflank-mailman (input) for mailman id 114715; Wed, 21 Apr 2021 14:26:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZDoc-0003mo-4P for xen-devel@lists.xenproject.org; Wed, 21 Apr 2021 14:26:54 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4eea3bb6-d7ab-44e6-845c-621b4b4e187c; Wed, 21 Apr 2021 14:26:53 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 408BDAF65; Wed, 21 Apr 2021 14:26:52 +0000 (UTC) X-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: 4eea3bb6-d7ab-44e6-845c-621b4b4e187c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1619015212; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u2H21liw5DO3IL1nQvzkhzYeKaGhal3AQ8PDJbmUMCo=; b=XqP2dv9mov/1KCzTSo1Vao8a0tPp7NgMQrVDUIvJR5jYig9xHAd2ROdke6ZI9n/T1Tauu2 ZnYLhA4Rf7N6krTfb7dFrXfNLyZOGQZdauKb5YxjH3iSuVMDzFOzjs8G5t4edx15tudKEy QZYEjB4sMA3miMyLa5I7PJgn59OaJwc= Subject: [PATCH v2 20/20] lib: move strsep() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu References: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Message-ID: Date: Wed, 21 Apr 2021 16:26:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <3ae091ce-6f6c-3ec6-abd3-4490239a707f@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Allow the function to be individually linkable, discardable, and overridable. Signed-off-by: Jan Beulich Acked-by: Julien Grall --- 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: + */