const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
-void list_sort(void *priv, struct list_head *head,
- int (*cmp)(void *priv, struct list_head *a,
- struct list_head *b));
+typedef int (*list_cmp_func_t)(void *priv, const struct list_head *a,
+ const struct list_head *b);
+
+void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
* sentinel head node, "prev" links not maintained.
*/
static struct list_head *merge(void *priv,
- int (*cmp)(void *priv, struct list_head *a,
- struct list_head *b),
+ list_cmp_func_t cmp,
struct list_head *a, struct list_head *b)
{
struct list_head head, *tail = &head;
* throughout.
*/
static void merge_and_restore_back_links(void *priv,
- int (*cmp)(void *priv, struct list_head *a,
- struct list_head *b),
+ list_cmp_func_t cmp,
struct list_head *head,
struct list_head *a, struct list_head *b)
{
* @b. If @a and @b are equivalent, and their original relative
* ordering is to be preserved, @cmp must return 0.
*/
-void list_sort(void *priv, struct list_head *head,
- int (*cmp)(void *priv, struct list_head *a,
- struct list_head *b))
+void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp)
{
struct list_head *part[MAX_LIST_LENGTH_BITS+1]; /* sorted partial lists
-- last slot is a sentinel */
static int
xfs_extent_free_diff_items(
void *priv,
- struct list_head *a,
- struct list_head *b)
+ const struct list_head *a,
+ const struct list_head *b)
{
- struct xfs_extent_free_item *ra;
- struct xfs_extent_free_item *rb;
+ const struct xfs_extent_free_item *ra;
+ const struct xfs_extent_free_item *rb;
ra = container_of(a, struct xfs_extent_free_item, xefi_list);
rb = container_of(b, struct xfs_extent_free_item, xefi_list);
static int
xfs_rmap_update_diff_items(
void *priv,
- struct list_head *a,
- struct list_head *b)
+ const struct list_head *a,
+ const struct list_head *b)
{
- struct xfs_rmap_intent *ra;
- struct xfs_rmap_intent *rb;
+ const struct xfs_rmap_intent *ra;
+ const struct xfs_rmap_intent *rb;
ra = container_of(a, struct xfs_rmap_intent, ri_list);
rb = container_of(b, struct xfs_rmap_intent, ri_list);
static int
xfs_refcount_update_diff_items(
void *priv,
- struct list_head *a,
- struct list_head *b)
+ const struct list_head *a,
+ const struct list_head *b)
{
- struct xfs_refcount_intent *ra;
- struct xfs_refcount_intent *rb;
+ const struct xfs_refcount_intent *ra;
+ const struct xfs_refcount_intent *rb;
ra = container_of(a, struct xfs_refcount_intent, ri_list);
rb = container_of(b, struct xfs_refcount_intent, ri_list);
static int
xfs_bmap_update_diff_items(
void *priv,
- struct list_head *a,
- struct list_head *b)
+ const struct list_head *a,
+ const struct list_head *b)
{
- struct xfs_bmap_intent *ba;
- struct xfs_bmap_intent *bb;
+ const struct xfs_bmap_intent *ba;
+ const struct xfs_bmap_intent *bb;
ba = container_of(a, struct xfs_bmap_intent, bi_list);
bb = container_of(b, struct xfs_bmap_intent, bi_list);
/* Sort action items in severity order. */
static int
PRIO(
- struct action_item *aitem,
+ const struct action_item *aitem,
int order)
{
if (aitem->flags & XFS_SCRUB_OFLAG_CORRUPT)
/* Sort the repair items in dependency order. */
static int
xfs_action_item_priority(
- struct action_item *aitem)
+ const struct action_item *aitem)
{
switch (aitem->type) {
case XFS_SCRUB_TYPE_SB:
static int
xfs_action_item_compare(
void *priv,
- struct list_head *a,
- struct list_head *b)
+ const struct list_head *a,
+ const struct list_head *b)
{
- struct action_item *ra;
- struct action_item *rb;
+ const struct action_item *ra;
+ const struct action_item *rb;
ra = container_of(a, struct action_item, list);
rb = container_of(b, struct action_item, list);