diff options
| author | Lukas Straub <lukasstraub2@web.de> | 2023-04-20 11:48:31 +0200 |
|---|---|---|
| committer | Juan Quintela <quintela@redhat.com> | 2023-05-08 15:25:26 +0200 |
| commit | 4024cc8506139a8f04f3f99ba478880410af10f5 (patch) | |
| tree | fa93c6e178d946193a406c37d522aefbe4141a86 /migration/qemu-file.c | |
| parent | b1f17720c117d4811b5571d87dcbc5b99d79266b (diff) | |
| download | focaccia-qemu-4024cc8506139a8f04f3f99ba478880410af10f5.tar.gz focaccia-qemu-4024cc8506139a8f04f3f99ba478880410af10f5.zip | |
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 <lukasstraub2@web.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/qemu-file.c')
| -rw-r--r-- | migration/qemu-file.c | 11 |
1 files changed, 11 insertions, 0 deletions
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 @@ -871,6 +871,17 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src) } /* + * 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. * Returns: len on success and a 0 terminated string in the buffer |