Skip to content

Commit

Permalink
move linux qsort def to platform header, fix fallout
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
  • Loading branch information
mattmacy committed Dec 2, 2019
1 parent 5142032 commit bc3ca90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 6 additions & 0 deletions include/os/linux/spl/sys/sysmacros.h
Expand Up @@ -192,6 +192,12 @@ extern void spl_cleanup(void);
#define SET_ERROR(err) \
(__set_error(__FILE__, __func__, __LINE__, err), err)

#if defined(_KERNEL)
#include <linux/sort.h>
#define qsort(base, num, size, cmp) \
sort(base, num, size, cmp, NULL)
#endif

#if defined(_KERNEL) && !defined(_KMEMUSER) && !defined(offsetof)

/* avoid any possibility of clashing with <stddef.h> version */
Expand Down
4 changes: 2 additions & 2 deletions module/lua/ltablib.c
Expand Up @@ -244,7 +244,7 @@ static void auxsort (lua_State *L, int l, int u) {
} /* repeat the routine for the larger one */
}

static int sort (lua_State *L) {
static int tsort (lua_State *L) {
int n = aux_getn(L, 1);
luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */
if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */
Expand All @@ -266,7 +266,7 @@ static const luaL_Reg tab_funcs[] = {
{"pack", pack},
{"unpack", unpack},
{"remove", tremove},
{"sort", sort},
{"sort", tsort},
{NULL, NULL}
};

Expand Down
6 changes: 1 addition & 5 deletions module/zcommon/zprop_common.c
Expand Up @@ -41,11 +41,7 @@
#include "zfs_prop.h"
#include "zfs_deleg.h"

#if defined(_KERNEL)
#include <linux/sort.h>
#define qsort(base, num, size, cmp) \
sort(base, num, size, cmp, NULL)
#else
#if !defined(_KERNEL)
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Expand Down

0 comments on commit bc3ca90

Please sign in to comment.