2 * mr_sas_list.h: header for mr_sas
4 * Solaris MegaRAID driver for SAS2.0 controllers
5 * Copyright (c) 2008-2012, LSI Logic Corporation.
9 /* Copyright 2012 Nexenta Systems, Inc. All rights reserved. */
12 * Extract C functions from LSI-provided mr_sas_list.h such that we can both
13 * be lint-clean and provide a slightly better source organizational model
14 * beyond preprocessor abuse.
17 #include "mr_sas_list.h"
20 * Insert a new entry between two known consecutive entries.
22 * This is only for internal list manipulation where we know
23 * the prev/next entries already!
26 __list_add(struct mlist_head
*new, struct mlist_head
*prev
,
27 struct mlist_head
*next
)
36 * mlist_add - add a new entry
37 * @new: new entry to be added
38 * @head: list head to add it after
40 * Insert a new entry after the specified head.
41 * This is good for implementing stacks.
44 mlist_add(struct mlist_head
*new, struct mlist_head
*head
)
46 __list_add(new, head
, head
->next
);
50 * mlist_add_tail - add a new entry
51 * @new: new entry to be added
52 * @head: list head to add it before
54 * Insert a new entry before the specified head.
55 * This is useful for implementing queues.
58 mlist_add_tail(struct mlist_head
*new, struct mlist_head
*head
)
60 __list_add(new, head
->prev
, head
);
64 * Delete a list entry by making the prev/next entries
65 * point to each other.
67 * This is only for internal list manipulation where we know
68 * the prev/next entries already!
71 __list_del(struct mlist_head
*prev
, struct mlist_head
*next
)
78 * mlist_del_init - deletes entry from list and reinitialize it.
79 * @entry: the element to delete from the list.
82 mlist_del_init(struct mlist_head
*entry
)
84 __list_del(entry
->prev
, entry
->next
);
85 INIT_LIST_HEAD(entry
);
89 * mlist_empty - tests whether a list is empty
90 * @head: the list to test.
93 mlist_empty(struct mlist_head
*head
)
95 return (head
->next
== head
);
99 * mlist_splice - join two lists
100 * @list: the new list to add.
101 * @head: the place to add it in the first list.
104 mlist_splice(struct mlist_head
*list
, struct mlist_head
*head
)
106 struct mlist_head
*first
= list
->next
;
109 struct mlist_head
*last
= list
->prev
;
110 struct mlist_head
*at
= head
->next
;