list.h 898 B

123456789101112131415161718192021222324252627282930
  1. #include <linux/compiler.h>
  2. #include <linux/kernel.h>
  3. #include <linux/types.h>
  4. #include "../../../include/linux/list.h"
  5. #ifndef TOOLS_LIST_H
  6. #define TOOLS_LIST_H
  7. /**
  8. * list_del_range - deletes range of entries from list.
  9. * @begin: first element in the range to delete from the list.
  10. * @end: last element in the range to delete from the list.
  11. * Note: list_empty on the range of entries does not return true after this,
  12. * the entries is in an undefined state.
  13. */
  14. static inline void list_del_range(struct list_head *begin,
  15. struct list_head *end)
  16. {
  17. begin->prev->next = end->next;
  18. end->next->prev = begin->prev;
  19. }
  20. /**
  21. * list_for_each_from - iterate over a list from one of its nodes
  22. * @pos: the &struct list_head to use as a loop cursor, from where to start
  23. * @head: the head for your list.
  24. */
  25. #define list_for_each_from(pos, head) \
  26. for (; pos != (head); pos = pos->next)
  27. #endif