[PATCH] sort: Introduce generic list_sort function
Andi Kleen
andi at firstfloor.org
Tue Jan 5 05:31:15 CST 2010
Dave Chinner <david at fromorbit.com> writes:
> +
> +/**
> + * list_sort - sort a list.
> + * @priv: private data, passed to @cmp
> + * @head: the list to sort
> + * @cmp: the elements comparison function
> + *
> + * This function has been implemented by Mark J Roberts <mjr at znex.org>. It
> + * implements "merge sort" which has O(nlog(n)) complexity. The list is sorted
> + * in ascending order.
> + *
> + * The comparison function @cmp is supposed to return a negative value if @a is
> + * than @b, and a positive value if @a is greater than @b. If @a and @b are
> + * equivalent, then it does not matter what this function returns.
> + */
> +void list_sort(void *priv, struct list_head *head,
> + int (*cmp)(void *priv, struct list_head *a,
> + struct list_head *b))
No EXPORT_SYMBOL?
Also it would seem cleaner to have it in a own file.
-Andi
--
ak at linux.intel.com -- Speaking for myself only.
More information about the xfs
mailing list