what started off as just some nonchalant poking around in kernel
data structures has become moderately educational.  i had no idea that
there is support for *sorting* the nodes of a kernel LL in
<linux/list_sort.h>:


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


  doesn't seem to be a lot of folks using that:

$ grep -rw list_sort *
drivers/gpu/drm/drm_modes.c:#include <linux/list_sort.h>
drivers/gpu/drm/drm_modes.c:    list_sort(NULL, mode_list, drm_mode_compare);
fs/xfs/linux-2.6/xfs_buf.c:#include <linux/list_sort.h>
fs/xfs/linux-2.6/xfs_buf.c:     list_sort(NULL, list, xfs_buf_cmp);
fs/xfs/linux-2.6/xfs_buf.c:             list_sort(NULL, &tmp, xfs_buf_cmp);
fs/xfs/linux-2.6/xfs_buf.c:     list_sort(NULL, &tmp_list, xfs_buf_cmp);
fs/ubifs/gc.c:#include <linux/list_sort.h>
fs/ubifs/gc.c:  list_sort(c, &sleb->nodes, &data_nodes_cmp);
fs/ubifs/gc.c:  list_sort(c, nondata, &nondata_nodes_cmp);
... extraneous junk snipped ...

  i wonder how much kernel code manually sorts a linked list, not
realizing that there's kernel library support for that.

rday


-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to