Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
list_sort.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/list_sort.h>
#include <linux/slab.h>
#include <linux/list.h>

Go to the source code of this file.

Macros

#define MAX_LIST_LENGTH_BITS   20
 

Functions

void list_sort (void *priv, struct list_head *head, int(*cmp)(void *priv, struct list_head *a, struct list_head *b))
 
 EXPORT_SYMBOL (list_sort)
 

Macro Definition Documentation

#define MAX_LIST_LENGTH_BITS   20

Definition at line 7 of file list_sort.c.

Function Documentation

EXPORT_SYMBOL ( list_sort  )
void list_sort ( void priv,
struct list_head head,
int(*)(void *priv, struct list_head *a, struct list_head *b cmp 
)

list_sort - sort a list : private data, opaque to list_sort(), passed to : the list to sort : the elements comparison function

This function implements "merge sort", which has O(nlog(n)) complexity.

The comparison function must return a negative value if should sort before , and a positive value if should sort after . If and are equivalent, and their original relative ordering is to be preserved, must return 0.

Definition at line 97 of file list_sort.c.