From nobody Sat Jan 22 19:36:42 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 41F03196C115; Sat, 22 Jan 2022 19:36:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jh6252NdGz3h7D; Sat, 22 Jan 2022 19:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tx9+sBq3LrMl7KsDAHILPh2Qtuwv2lt8Zdp01jkPEW0=; b=pRLIVbZXWt3l75ySreqmy1M1ASVoHLswH1M0w3KE+132KvdMa1bKWDUKG5I/6OuVWv78m9 eWl52LnQ5YhzSNF1lwkZXz8d8LnUnOXrsM6wDAuvjKY4ApqIctvWDCe8Yq61DuwF0bt5Dw E4NwhK3hiuULxlABkEx2wdA3b7fAKF0X4tBpfW8o4sAleA5Jl1lanX38ClSm0a6K7tMQsq 0YdfzHxztv41TrnP95ZwVmDkRroBjXr85/2oPS+ElkEqOBaQK+gitYKLOEnj7qCwTNKocX HRmpW4/HYNN9Q1T/VGfkZaewRIx4RoCamcvh12HHQrkfcFpGIDz/m++2lpkKyQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B1EE14EC2; Sat, 22 Jan 2022 19:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20MJag34000471; Sat, 22 Jan 2022 19:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20MJagAk000470; Sat, 22 Jan 2022 19:36:42 GMT (envelope-from git) Date: Sat, 22 Jan 2022 19:36:42 GMT Message-Id: <202201221936.20MJagAk000470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: ba0f2d780717 - stable/13 - LinuxKPI: Add sort() wrapper. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ba0f2d7807176f330f1fd08bf1e5a992b2f0d618 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642880205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tx9+sBq3LrMl7KsDAHILPh2Qtuwv2lt8Zdp01jkPEW0=; b=UXyk4qW/bO/3cobY7z2HjeZCMGiNwJCeYj/oS6EZc0q+MHBI+AhDCx/jDoiQvRKiy55luk 7VDvIGWVAY9l7L6R5XrYN49A71GiBdXVOltkrlGmgJ9fEKZXSxnYakAfHs6uvv/yTvEdxa 5vpTuQo1jnrn0ISGtV9rHPvgaipmH2Nr3LIgJLd0Il1LrQeAkO0JZ3c5D0awJbOL+GUW9o G6OtixRYqzEdGXvQWxMxyNroC4z5wA2FkugHmR1l4wQKgKiOfihCmM9jC5QnsHJXD3HsrT 3NvFM3Y3bvLz63M4wpaeP0ne8MAP/hjBFUi3khlr8Zg5XLgTCd7Lx5MvKMTcKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642880205; a=rsa-sha256; cv=none; b=QXFtGLInfnbDe5U3vsXjQ8Ka4/W8Q2FB+LOj64LAjph+Wqww14clVdIy1DYynFIfdg5/S3 E2QC/UVdQKB6zjDWH/6qku0WpbRkBzmdyYZpP4gcakPu/wsZcl8zxlqGNMvnIulm4mnxH/ V8V0G1/uYxSfdeO1cbUlo3+EhK1gtKt5ou5IoKzznJtJT2kCTlfDtwU/zbQPKAKY/HDH9i /hRCMVKda/hH6mPQazbx1Zi6GfqzzqQIcZj71fsDnek1gG/OSxiZ97oCUf+yt3KtthxcOr q5+E0D9zi+Dq5oG7zm/oiWH8xcu08TTjoQA3Bg1z+E9a65+kDaMNYqxvias/GA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=ba0f2d7807176f330f1fd08bf1e5a992b2f0d618 commit ba0f2d7807176f330f1fd08bf1e5a992b2f0d618 Author: Vladimir Kondratyev AuthorDate: 2021-12-25 09:15:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-22 19:34:38 +0000 LinuxKPI: Add sort() wrapper. swap parameter is not supported as it is rarely used in Linux kernel and its implementation will add some preprocessor spaghetti to qsort. Required by drm-kmod. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33675 (cherry picked from commit 7356f661e81d1ff88bdb4daa127f3bfa2be7ecb9) --- sys/compat/linuxkpi/common/include/linux/sort.h | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/sort.h b/sys/compat/linuxkpi/common/include/linux/sort.h new file mode 100644 index 000000000000..91ccd7ff83c4 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/sort.h @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Vladimir Kondratyev + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_SORT_H_ +#define _LINUXKPI_LINUX_SORT_H_ + +#include +#include + +#include + +#define sort(base, num, size, cmp, swap) do { \ + BUILD_BUG_ON_ZERO(swap); \ + qsort(base, num, size, cmp); \ +} while (0) + +#endif /* _LINUXKPI_LINUX_SORT_H_ */