at v6.17 993 B view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_SORT_H 3#define _LINUX_SORT_H 4 5#include <linux/types.h> 6 7/** 8 * cmp_int - perform a three-way comparison of the arguments 9 * @l: the left argument 10 * @r: the right argument 11 * 12 * Return: 1 if the left argument is greater than the right one; 0 if the 13 * arguments are equal; -1 if the left argument is less than the right one. 14 */ 15#define cmp_int(l, r) (((l) > (r)) - ((l) < (r))) 16 17void sort_r(void *base, size_t num, size_t size, 18 cmp_r_func_t cmp_func, 19 swap_r_func_t swap_func, 20 const void *priv); 21 22void sort(void *base, size_t num, size_t size, 23 cmp_func_t cmp_func, 24 swap_func_t swap_func); 25 26/* Versions that periodically call cond_resched(): */ 27 28void sort_r_nonatomic(void *base, size_t num, size_t size, 29 cmp_r_func_t cmp_func, 30 swap_r_func_t swap_func, 31 const void *priv); 32 33void sort_nonatomic(void *base, size_t num, size_t size, 34 cmp_func_t cmp_func, 35 swap_func_t swap_func); 36 37#endif