From 4024cc8506139a8f04f3f99ba478880410af10f5 Mon Sep 17 00:00:00 2001 From: Lukas Straub Date: Thu, 20 Apr 2023 11:48:31 +0200 Subject: ram compress: Assert that the file buffer matches the result Before this series, "nothing to send" was handled by the file buffer being empty. Now it is tracked via param->result. Assert that the file buffer state matches the result. Signed-off-by: Lukas Straub Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/qemu-file.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'migration/qemu-file.c') diff --git a/migration/qemu-file.c b/migration/qemu-file.c index f4cfd05c67..61fb580342 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -870,6 +870,17 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src) return len; } +/* + * Check if the writable buffer is empty + */ + +bool qemu_file_buffer_empty(QEMUFile *file) +{ + assert(qemu_file_is_writable(file)); + + return !file->iovcnt; +} + /* * Get a string whose length is determined by a single preceding byte * A preallocated 256 byte buffer must be passed in. -- cgit v1.2.3