migration/multifd: Make MultiFDPages_t:offset a flexible array member
authorFabiano Rosas <farosas@suse.de>
Tue, 27 Aug 2024 17:45:53 +0000 (14:45 -0300)
committerFabiano Rosas <farosas@suse.de>
Tue, 3 Sep 2024 19:24:35 +0000 (16:24 -0300)
commit0e427da096d46860c2a5755295d1e05647e90154
tree27814584a7cdd4cd2b887b22fac95401e1ef41bc
parentaddd7d15816f2ee65911d30a38357cc2004f22eb
migration/multifd: Make MultiFDPages_t:offset a flexible array member

We're about to use MultiFDPages_t from inside the MultiFDSendData
payload union, which means we cannot have pointers to allocated data
inside the pages structure, otherwise we'd lose the reference to that
memory once another payload type touches the union. Move the offset
array into the end of the structure and turn it into a flexible array
member, so it is allocated along with the rest of MultiFDSendData in
the next patches.

Note that other pointers, such as the ramblock pointer are still fine
as long as the storage for them is not owned by the migration code and
can be correctly released at some point.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
migration/multifd.c
migration/multifd.h