Skip to content
Permalink
Browse files

move linux qsort def to platform header, fix fallout

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
  • Loading branch information
mattmacy committed Dec 2, 2019
1 parent 5142032 commit bc3ca90e344e1cdf8b9b4354656b142ccee89b29
Showing with 9 additions and 7 deletions.
  1. +6 −0 include/os/linux/spl/sys/sysmacros.h
  2. +2 −2 module/lua/ltablib.c
  3. +1 −5 module/zcommon/zprop_common.c
@@ -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 */
@@ -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? */
@@ -266,7 +266,7 @@ static const luaL_Reg tab_funcs[] = {
{"pack", pack},
{"unpack", unpack},
{"remove", tremove},
{"sort", sort},
{"sort", tsort},
{NULL, NULL}
};

@@ -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>

0 comments on commit bc3ca90

Please sign in to comment.
You can’t perform that action at this time.