Allowing anonymous structs and unions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 23, 2015 at 10:34:06AM +0200, Ahmed S. Darwish wrote:
> 
> So to summarize, such annotation explicitly shows the inheritance
> relationship, minimize code repeition in the struct defintions, and
> also saves us an extra compile-time dereference in shm.c, memfd.c,
> and privatemem.c code. It also really works in tandem with the
> earlier polymorphic union:
> 
>     union {
>         pa_mem mem;
>         union {
>             pa_shm shm;
>             pa_memfd memfd;
>             pa_privatemem privatemem;
>         } per_type;
>     };
>

For extra-context if anyone did not yet check the memfd patches
in detail, the above union is used in two places:

- In mempools, according to their memory type

- In memimport segments. That is, in the case where we import
  a memblock from another PA endpoint. In this case, the
  imported memblock memory type (posix SHM or memfds) can be
  quite different from the mempool it's locally attached to
  (as is the usual case with PA_MEMBLOCK_IMPORTED blocks).


Thanks!

-- 
Darwish
http://darwish.chasingpointers.com


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux