|
@@ -212,4 +212,23 @@ static inline int list_empty ( const struct list_head *list ) {
|
212
|
212
|
pos = tmp, \
|
213
|
213
|
tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) )
|
214
|
214
|
|
|
215
|
+/**
|
|
216
|
+ * Check list contains a specified entry
|
|
217
|
+ *
|
|
218
|
+ * @v entry Entry
|
|
219
|
+ * @v head List head
|
|
220
|
+ * @v member Name of list field within iterator's type
|
|
221
|
+ */
|
|
222
|
+#define list_check_contains( entry, head, member ) do { \
|
|
223
|
+ if ( ASSERTING ) { \
|
|
224
|
+ typeof ( entry ) tmp; \
|
|
225
|
+ int found = 0; \
|
|
226
|
+ list_for_each_entry ( tmp, head, member ) { \
|
|
227
|
+ if ( tmp == entry ) \
|
|
228
|
+ found = 1; \
|
|
229
|
+ } \
|
|
230
|
+ assert ( found ); \
|
|
231
|
+ } \
|
|
232
|
+ } while ( 0 )
|
|
233
|
+
|
215
|
234
|
#endif /* _IPXE_LIST_H */
|