Re: [igt-dev] [PATCH i-g-t] lib/igt_list: Update, clean-up and document igt_list

Chris Wilson
2019-10-25T08:28:13Z

Quoting Arkadiusz Hiler (2019-10-24 13:31:14)
> Our list was something between Wayland and Linux Kernel list
> implementations, right in the uncanny valley.
>
> On top of that it falsely claimed that it's a straight copy from the
> Wayland project.
>
> Let's make our impl more akin to the kernel one to ease the cognitive
> dissonance for the developers working on all those projects.
>
> This patch:
> * mimics the current kernel list interface
> * separates IGT helpers in the source files
> * adds brief explanation and code example for igt-doc
> * introduces igt_list.c as static inlines are not visible in the docs
>
> v2: mimic the kernel instead of wayland (Chris)
> - _head suffix for the sentinel/link struct
> - _entry_ in iterator names that go over the elements

We didn't list the _head suffix as the list is both its head and
node. :)

The other option was to go with mesa's with automatic variables
(different container_of implementation).

> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I'd get a second opinion, but since you feel strongly enough to write
the patch...

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris