Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38 lines
993 B
C
38 lines
993 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_SORT_H
|
|
#define _LINUX_SORT_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
/**
|
|
* cmp_int - perform a three-way comparison of the arguments
|
|
* @l: the left argument
|
|
* @r: the right argument
|
|
*
|
|
* Return: 1 if the left argument is greater than the right one; 0 if the
|
|
* arguments are equal; -1 if the left argument is less than the right one.
|
|
*/
|
|
#define cmp_int(l, r) (((l) > (r)) - ((l) < (r)))
|
|
|
|
void sort_r(void *base, size_t num, size_t size,
|
|
cmp_r_func_t cmp_func,
|
|
swap_r_func_t swap_func,
|
|
const void *priv);
|
|
|
|
void sort(void *base, size_t num, size_t size,
|
|
cmp_func_t cmp_func,
|
|
swap_func_t swap_func);
|
|
|
|
/* Versions that periodically call cond_resched(): */
|
|
|
|
void sort_r_nonatomic(void *base, size_t num, size_t size,
|
|
cmp_r_func_t cmp_func,
|
|
swap_r_func_t swap_func,
|
|
const void *priv);
|
|
|
|
void sort_nonatomic(void *base, size_t num, size_t size,
|
|
cmp_func_t cmp_func,
|
|
swap_func_t swap_func);
|
|
|
|
#endif
|