--- /dev/null
+Optional QSort
+~~~~~~~~~~~~~~
+
+Yaffs needs a sort function for sorting block indices during scanning.
+
+Most systems already have qsort (or an equivalent that can be used)
+as part of the standard library and generally it is best to use that.
+
+For those systems that do not have this, we supply the qsort in this
+directory.
+
+This qsort.c file is the only code that is supplied as part of the
+Yaffs Direct code that is NOT written, from the ground up, by Aleph One.
+
+The licensing terms are fairly innocuous. Please read the banner at the top
+of qsort.c
+
+
+
* SUCH DAMAGE.
*/
-#include "yportenv.h"
-/* #include <linux/string.h> */
+#include <stdlib.h>
+#include <string.h>
/*
* Qsort routine from Bentley & McIlroy's "Engineering a Sort Function".
#endif
void
-yaffs_qsort(void *aa, size_t n, size_t es,
+qsort(void *aa, size_t n, size_t es,
int (*cmp)(const void *, const void *))
{
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
yaffs_tagscompat.o yaffs_tagsmarshall.o \
yaffs_packedtags2.o yaffs_nand.o \
- yaffs_checkptrw.o yaffs_qsort.o\
+ yaffs_checkptrw.o \
yaffs_nameval.o yaffs_attribs.o \
yaffs_m18_drv.o yaffs_nor_drv.o ynorsim.o \
yaffs_nand_drv.o \
YAFFSDIRECTSYMLINKS = \
yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
yaffsfs.h yaffs_osglue.h ydirectenv.h \
- yaffscfg.h yaffs_qsort.c \
+ yaffscfg.h \
yaffs_nandemul2k.h yaffs_list.h \
yaffs_attribs.c \
yportenv.h \
#define hweight8(x) yaffs_hweight8(x)
#define hweight32(x) yaffs_hweight32(x)
-void yaffs_qsort(void *aa, size_t n, size_t es,
- int (*cmp)(const void *, const void *));
-
-#define sort(base, n, sz, cmp_fn, swp) yaffs_qsort(base, n, sz, cmp_fn)
+#define sort(base, n, sz, cmp_fn, swp) qsort(base, n, sz, cmp_fn)
#define YAFFS_PATH_DIVIDERS "/"