Message ID | 1433944027-28533-11-git-send-email-kwolf@redhat.com |
---|---|
State | New |
Headers | show |
On 06/10/2015 07:47 AM, Kevin Wolf wrote: > If the head of a list has been moved to a different memory location, the > le_prev link in the first list entry has to be fixed up. Provide a macro > that implements this fixup. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > include/qemu/queue.h | 6 ++++++ > 1 file changed, 6 insertions(+) > Reviewed-by: Eric Blake <eblake@redhat.com>
On 10.06.2015 15:47, Kevin Wolf wrote: > If the head of a list has been moved to a different memory location, the > le_prev link in the first list entry has to be fixed up. Provide a macro > that implements this fixup. > > Signed-off-by: Kevin Wolf <kwolf@redhat.com> > --- > include/qemu/queue.h | 6 ++++++ > 1 file changed, 6 insertions(+) Reviewed-by: Max Reitz <mreitz@redhat.com>
diff --git a/include/qemu/queue.h b/include/qemu/queue.h index f781aa2..a8d3cb8 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -117,6 +117,12 @@ struct { \ } \ } while (/*CONSTCOND*/0) +#define QLIST_FIX_HEAD_PTR(head, field) do { \ + if ((head)->lh_first != NULL) { \ + (head)->lh_first->field.le_prev = &(head)->lh_first; \ + } \ +} while (/*CONSTCOND*/0) + #define QLIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \
If the head of a list has been moved to a different memory location, the le_prev link in the first list entry has to be fixed up. Provide a macro that implements this fixup. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- include/qemu/queue.h | 6 ++++++ 1 file changed, 6 insertions(+)