From nobody Mon Jan 10 19:50:55 2022 X-Original-To: dev-commits-src-all@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 E45121954A44; Mon, 10 Jan 2022 19:50:59 +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 4JXkw12xHmz3Nys; Mon, 10 Jan 2022 19:50:57 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 19F912EDD; Mon, 10 Jan 2022 19:50:55 +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 20AJot6s009480; Mon, 10 Jan 2022 19:50:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AJotm2009479; Mon, 10 Jan 2022 19:50:55 GMT (envelope-from git) Date: Mon, 10 Jan 2022 19:50:55 GMT Message-Id: <202201101950.20AJotm2009479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 7356f661e81d - main - LinuxKPI: Add sort() wrapper. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 7356f661e81d1ff88bdb4daa127f3bfa2be7ecb9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641844257; 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=wgoSpZWqABg5rFHEjDTAuiUu7E+OsLOpIfFQcl+n11U=; b=jaj+H9HRoTxrrSz4PLpGnEXe8sPhyOmVK77JJmwindeIKFjBfMlWxLJ6FD8JgJGT1O1tz0 bI5wsJMXZr5/CL1JqVrBO8Zn6epoAOiEtwVn/Sg6y8y6hmbZ9R8LQJae5zhVZXai7JhTYz 1FSsEtVvAoPzm5+odXtGGPQUQslBdR4sCkY08jM7xuNNG8B2cyNDHPnPzFR0vI1K/BUDjs e8HR9WTipZxF5r9o9Ry78x6djLwAuHNIIhb9wBxU7lSU7sitja+Mo+yLVgExhURrE+RWcK f7qSgmlSJRV7d18YHgN3/qkrPWHoJgCtSs+BTBk6EqW6gFw72aNOrkUcDTzMnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641844257; a=rsa-sha256; cv=none; b=awN7EOgTR0m59t5nrw/kp00omreNQOt9+0eroWaAHJCjg4Og7QBGpqHBzDdtFPUY4Y/rh1 YYtW+vYxYUB7joXPPTXPHW0bH4zftsy6uxwgl/MYxV/kiq38fHShL8tJPcHgTKz3Ew1+rv HhEL7u9l0r6BDjrAHVShaplJThLhvUD+NzVsDEjqfbYr40OsnEYJn4Jr2w2CDEgueZN6iO l8pGjjkTU25t8N9v6MAeXNx794hY3hBObwEEiK2k37K/BJroft6dB4DHQT/je8YvkgVVdD ygdDhaRMb2qHIwhDypobo0QT2L7w7Ikot5V9lNBdZQyeslOj36X2pwjAMwbhpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=7356f661e81d1ff88bdb4daa127f3bfa2be7ecb9 commit 7356f661e81d1ff88bdb4daa127f3bfa2be7ecb9 Author: Vladimir Kondratyev AuthorDate: 2021-12-25 09:15:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-01-10 19:49: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 --- 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_ */