Date: Wed, 13 Mar 2019 18:47:18 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345097 - head/sys/compat/linuxkpi/common/include/linux Message-ID: <201903131847.x2DIlIEw086600@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Mar 13 18:47:17 2019 New Revision: 345097 URL: https://svnweb.freebsd.org/changeset/base/345097 Log: Implement list_for_each_entry_from_reverse() and list_bulk_move_tail() in the LinuxKPI. Submitted by: Johannes Lundberg <johalun0@gmail.com> MFC after: 1 week Sponsored by: Limelight Networks Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Wed Mar 13 18:44:06 2019 (r345096) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Wed Mar 13 18:47:17 2019 (r345097) @@ -228,6 +228,10 @@ list_del_init(struct list_head *entry) #define list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = (p)->prev) +#define list_for_each_entry_from_reverse(p, h, field) \ + for (; &p->field != (h); \ + p = list_prev_entry(p, field)) + static inline void list_add(struct list_head *new, struct list_head *head) { @@ -256,6 +260,18 @@ list_move_tail(struct list_head *entry, struct list_he list_del(entry); list_add_tail(entry, head); +} + +static inline void +list_bulk_move_tail(struct list_head *head, struct list_head *first, + struct list_head *last) +{ + first->prev->next = last->next; + last->next->prev = first->prev; + head->prev->next = first; + first->prev = head->prev; + last->next = head; + head->prev = last; } static inline void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903131847.x2DIlIEw086600>