Date: Fri, 5 Apr 2019 11:17:28 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r345922 - stable/11/sys/compat/linuxkpi/common/include/linux Message-ID: <201904051117.x35BHSdR002115@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Apr 5 11:17:27 2019 New Revision: 345922 URL: https://svnweb.freebsd.org/changeset/base/345922 Log: MFC r345097: Implement list_for_each_entry_from_reverse() and list_bulk_move_tail() in the LinuxKPI. Submitted by: Johannes Lundberg <johalun0@gmail.com> Sponsored by: Limelight Networks Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/list.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/list.h Fri Apr 5 11:17:12 2019 (r345921) +++ stable/11/sys/compat/linuxkpi/common/include/linux/list.h Fri Apr 5 11:17:27 2019 (r345922) @@ -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?201904051117.x35BHSdR002115>