migration/multifd: Split packet into header and RAM data

Read packet header first so in the future we will be able to
differentiate between a RAM multifd packet and a device state multifd
packet.

Since these two are of different size we can't read the packet body until
we know which packet type it is.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/qemu-devel/832ad055fe447561ac1ad565d61658660cb3f63f.1741124640.git.maciej.szmigiero@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Maciej S. Szmigiero 2025-03-04 23:03:37 +01:00 committed by Cédric Le Goater
parent b1937fd1eb
commit 8050c435b7
2 changed files with 49 additions and 11 deletions

View file

@ -69,6 +69,11 @@ typedef struct {
uint32_t magic;
uint32_t version;
uint32_t flags;
} __attribute__((packed)) MultiFDPacketHdr_t;
typedef struct {
MultiFDPacketHdr_t hdr;
/* maximum number of allocated pages */
uint32_t pages_alloc;
/* non zero pages */